android-dialogfragment

Android full-screen dialog callback issue

Deadly 提交于 2019-11-29 01:37:21
问题 I am having trouble wrapping my head around something but let me first describe my setup: I have an activity that references 3 fragments, each one of them get shown at the correct time. This is how the ChildrenSpecificationFragment looks: If the user clicks the floating action button the following DialogFragment opens: I found the following information in the new material design guidelines: https://www.google.com/design/spec/components/dialogs.html#dialogs-full-screen-dialogs Avoid dialogs

Android 6.0 Dialog text doesn't appear

£可爱£侵袭症+ 提交于 2019-11-29 01:05:22
I updated my phone to Android 6.0 and I have these 2 problems with dialogs: 1)The title is shown but the messages isn't for alert dialog(SOLVED): new AlertDialog.Builder(context).setTitle("Title").setMessage("Message"); 2)Also custom dialog fragment's title is not shown(NOT SOLVED): getDialog().setTitle("Title"); There was not such a problem in lollipop or in older versions, the problem appeared only after updating my phone to marshmallow. How to solve the problem? Use constructor with theme for Lollipop and newer android versions: Dark theme AlertDialog.Builder builder; if (Build.VERSION.SDK

DialogFrag#show() from a Fragment throwing “IllegalStateException: Can not perform this action after onSaveInstanceState”

爷,独闯天下 提交于 2019-11-28 23:26:52
Just to be clear, I have read the dozen top SO questions on "IllegalStateException: Can not perform this action after onSaveInstanceState" and I have read Alex Lockwood's blog post on the issue http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html So I'm not asking this blindly. I have a very simple use case case that doesn't involve AsyncTask or any background processing. I have a Fragment that contains a button. On the onClickListener for the button, I create a DialogFragment and show it. public final class OverviewFragment extends Fragment { @Override

How to change background color of the snackbar?

↘锁芯ラ 提交于 2019-11-28 17:08:11
I am showing snackbar in DialogFragment Within the Positive click of alertDialog. Here is my code snippet. Snackbar snackbar = Snackbar.make(view, "Please enter customer name", Snackbar.LENGTH_LONG) .setAction("Action", null); View sbView = snackbar.getView(); sbView.setBackgroundColor(Color.BLACK); snackbar.show(); I am passing view of the dialogfragment to the snackbar. I want the background color black? How can I do this? I am returning alertDialog in the DialogFragment. And the theme I am setting to the dialog as follow's <style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light

DialogFragment and force to show keyboard

纵饮孤独 提交于 2019-11-28 17:01:09
问题 I have a problem with my DialogFragment. So to create my view, I use the method described on the android blog. Here is my DialogFragment @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View myLayout = inflater.inflate(R.layout.dialog_connect, null); edit = (EditText) myLayout.findViewById(R.id.password_edit); edit.requestFocus(); getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE); return myLayout;

How to set the title of DialogFragment?

被刻印的时光 ゝ 提交于 2019-11-28 16:35:44
This should be a simple task, but for some reason I can find a way to set the title of a DialogFragment . (I am setting the dialog contents using onCreateView overload). The default style leaves a place for the title, but I can't find any method on the DialogFragment class to set it. The title is somehow magically set when the onCreateDialog method is used to set the contents, so I wonder if this is by design, or there is a special trick to set it when using the onCreateView overload. Rob Holmes You can use getDialog().setTitle("My Dialog Title") Just like this: public static class

DialogFragment FEATURE_NO_TITLE is shrunk

99封情书 提交于 2019-11-28 14:19:38
I'm displaying a DialogFragment . I implemented it with no problems, until I decided to remove the title using getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); .After doing that the whole thing shrinks. Here are my xml and class files. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="@color/white" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="@dimen/activity_vertical_margin"> <TextView android:id="@+id/product_name"

Custom dialog too small

我的未来我决定 提交于 2019-11-28 10:52:07
I have an android activity that implements a custom dialog.The application is running ok but the dialog is too small,i want to display a bigger dialog.How can i achieve this? Here is my layout xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable

Dismiss dialog causes activity finish

浪尽此生 提交于 2019-11-28 10:15:45
问题 My PanelActivity contains a recyclerView with a list of items. Each item has a click event. This click opens DetailsActivity . DetailsActivity has a floatingActionButton that opens a full screen dialog (my class DetailDialogFragment extends DialogFragment ). DetailDialogFragment has an Up/Home button with a dismiss. The problem: If the user performs a click over the Up button, the dialog is dismissed, but also DetailsActivity disappear, and the app returns to the PanelActivity . Possible

Should I use a PopupWindow or DialogFragment for accepting input?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 09:45:16
I am doing a Popup with 3 Spinners and an EditText. After reading many blogs and articles I can't decide which is the best option, PopupWindow or DialogFragment . The criteria would be: Compatibility with different Android's versions Performance If there is a better way to do it I am open to change the perspective. Thank you very much. DialogFragment: Pros: Cons: PopupWindow: Pros: Cons: EDIT: CONCLUSION DialogFragment allows you to use more complex features. Another important thing is that it is more tablet-friendly as it lets user to have opened more than one fragment at a time. Fragments