android-dialogfragment

DialogFragment remove black border

只谈情不闲聊 提交于 2019-11-30 23:56:16
I saw this question and also this one and some others, but nothing really helped me. I'm building a quick action DialogFragment for my list view and trying to set a custom view to it according to the android dev guide . view_quick_action.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" > <ImageView android:id="@+id/quick_action_image" android:layout_width="50dp" android:layout_height="50dp" android:layout_margin=

Fullscreen DialogFragment with translucent StatusBar

天涯浪子 提交于 2019-11-30 22:46:47
问题 I have a DialogFragment which I want to show in fullscreen. I do however still want a StatusBar present, and the hardware buttons at the bottom. I also want to set a background color of the StatusBar (for Lollipop). My problem is that if I set the following flags in the DialogFragment: getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); Both the StatusBar and Hardware keyboard becomes

AutoCompleteTextView allow only suggested options

南楼画角 提交于 2019-11-30 19:04:52
I have a DialogFragment that contains AutoCompleteTextView , and Cancel and OK buttons. The AutoCompleteTextView is giving suggestions of usernames that I'm getting from server. What I want to do is to restrict the user to be able to enter only existing usernames. I know I can do check if that username exists when the user clicks OK , but is there some other way, let's say not allow the user to enter character if there doesn't exist such username. I don't know how to do this because on each entered character I'm getting only up to 5 suggestions. The server is implemented that way. Any

How to set font size for text of dialog buttons

拈花ヽ惹草 提交于 2019-11-30 18:45:54
I have an android app that uses some custom dialogs which are inflated from XML layouts. The contents of the dialog's view come from the XML layout, but the actual positive and negative buttons are added by calling the builder's setPositiveButton and setNegativeButton methods, so I have no control over (or at least don't know how to control) the styling of the buttons themselves. See the onCreateDialog method below from my LoginConfirmationDialog.java file which extends DialogFragment. It basically pops a very simple dialog up that asks for confirmation of who is logging in (i.e. "Are you Joe

What is lifecycle of DialogFragment

ε祈祈猫儿з 提交于 2019-11-30 13:53:14
I could not find proper lifecycle of android.support.v4.app.DialogFragment by searching on Google. I need this for some implementation. As we know DialogFragment has some methods same like Dialog . DialogFragment extends Fragment so its lifecycle is same as Fragment . But what about other methods of DialogFragment ? Here is Fragment lifecycle. Can one provide for DialogFragment ? DialogFragment life cycle is similar to the life cycle of fragment: . To test yourself put logs in each of the overrided methods of dialogFragment and then run your code you will understand the working of

DialogFragment has blue line on top in Android 4.4.2

强颜欢笑 提交于 2019-11-30 13:03:01
There's a blue line appearing on top of my dialog fragment that I can't get rid off(I don't even know why does it appear in the first place. Does anybody know on how to get rid of this? I have tested it on several devices and it works just fine on later Android versions. My code: private void setupDialog() { final Dialog dialog = getDialog(); final Window window = dialog.getWindow(); window.setBackgroundDrawable(new ColorDrawable(0)); window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); } layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=

Receiving data from a DialogFragment if you're calling from an Activity vs a Fragment?

空扰寡人 提交于 2019-11-30 09:44:18
问题 I call my DialogFragment like so: If I am in an Activity: MyDialogFragment dialogfragment = new MyDialogFragment(); dialogfragment.show(getFragmentManager(), ""); If I am already in a Fragment: MyDialogFragment dialogfragment = new MyDialogFragment(); dialogfragment.show(getActivity().getFragmentManager(), ""); In MyDialogFragment, which inflates an XML and allows the user to input some values to EditTexts and so forth, I want to be able to return those values back to wherever I called the

Why use newInstance for DialogFragment instead of the constructor?

柔情痞子 提交于 2019-11-30 08:47:59
Looking at the documentation of DialogFragment , one sees the static newInstance method to initialize a new alert dialog fragment. My question is, why not use a constructor to do so, like this: public MyAlertDialogFragment(int title) { Bundle args = new Bundle(); args.putInt("title", title); setArguments(args); } Isn't this exactly the same or does it differ somehow? What's the best approach and why ? If you overload the constructor with MyAlertDialogFragment(int title) , the Android system may still call the default MyAlertDialogFragment() constructor if the Fragment needs to be recreated and

How to execute action after DialogFragment positive button clicked

一笑奈何 提交于 2019-11-30 07:23:39
I created the following DialogFragment deriving it from the Android documentation: public class PayBillDialogFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState){ final Bundle b = this.getArguments(); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("Paga bollettino") .setPositiveButton("Paga", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // FIRE ZE MISSILES! } }) .setNegativeButton("Cancella", new

Managing activity from DialogFragment

假装没事ソ 提交于 2019-11-30 06:32:30
问题 How can I call finish() and other non static methods from a DialogFragment in the activity that created it? I have tried passing messages from the OnClickLisener in the DialogFragment, to no avail. I have a really simple app, conssting of a MainActivity and DialogFragment: public class MainActivity extends Activity { @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.activity); showDialog(); } public void showDialog() { DialogFragment newFragment =