android-dialog

Reset an Android Dialog

点点圈 提交于 2020-01-05 08:09:39
问题 I found plenty of topics on how to save states of a dialog, for instance using Bundle instances. However, I can't seem to find how to "properly" reset a dialog. Consider this sample custom dialog (the XML layout carries an EditText with ID "input_text"): public class CustomDialog extends Dialog { public CustomDialog (Context context) { super (context); } protected onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); setContentView(R.layout.input_query); EditText txt =

Formatted value of NumberPicker disappears onClick

心不动则不痛 提交于 2020-01-04 09:17:45
问题 My NumberPicker in setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS) mode and the setWrapSelectorWheel(false) is turned off. I formatted my Numberpicker with a simple formatter: mNumberPicker.setFormatter(new NumberPicker.Formatter() { @Override public String format(int value) { return TextUtils.makeQuatityString(getContext(), value, R.plurals.nWeek); } }); Example output: 4 Weeks, where 4 is the value. The NumberPicker is in a Dialog and after a short click on the value, the "Weeks"

DailogFragment - getArguments/setArguments - why passing arguments in a bundle?

一世执手 提交于 2020-01-03 15:17:07
问题 In the official example http://developer.android.com/reference/android/app/DialogFragment.html#BasicDialog the fragment is being created with use of static factory method that wraps arguments in a Bundle and calls no-args constructor passing args with setArguments(bundle)- so my question is - why not simply make public constructor with these arguments? What is the reason for using getArguments/setArguments fragment's methods - is maybe Dialog not guaranteed to be recreated each time, but

Dialog themed activity : positive and negative buttons

江枫思渺然 提交于 2019-12-31 22:22:24
问题 I'm trying to theme an activity as an AlertDialog . The problem I'm facing is that I can't find a way to put two buttons on the bottom of my window that would look like the positive and negative buttons of an AlertDialog I've already added that line to my Activity in the manifest (I'm using Sherlock Library): android:theme="@style/Theme.Sherlock.Dialog" And the Activity is looking exactly like a Dialog, but I can't find a theme to set on the buttons. What could I do? 回答1: Alright, if you're

How to disable BottomSheetDialogFragment dragging

耗尽温柔 提交于 2019-12-31 10:41:57
问题 How to disable BottomSheetDialogFragment dragging by finger? I saw similar questions, but they're all about BottomSheet not BottomSheetDialogFragment . 回答1: Having created MyActivity as follows: public class MyActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); new MyBottomSheetFragment().show(getSupportFragmentManager(), "tag"); } public static class

How to disable BottomSheetDialogFragment dragging

会有一股神秘感。 提交于 2019-12-31 10:41:08
问题 How to disable BottomSheetDialogFragment dragging by finger? I saw similar questions, but they're all about BottomSheet not BottomSheetDialogFragment . 回答1: Having created MyActivity as follows: public class MyActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); new MyBottomSheetFragment().show(getSupportFragmentManager(), "tag"); } public static class

How to re size the Height of the Items in Spinner with multiple choice?

馋奶兔 提交于 2019-12-30 06:58:19
问题 I just showing the spinner with multiple choice based on this stackoverflow answer(see @Destil answer). Here my problem is I can't re size the Height of the items in Spinner with multiple choice. How to re size the Height of each Items? 回答1: As i know, you will have to use a custom adapter, and override the getDropDown and the getView methods. You will be able to customize each item customizing the layout. Well... words are good, example better, try something like that : public class

Adding positive / negative Button to DialogFragment's Dialog

放肆的年华 提交于 2019-12-28 11:57:22
问题 I've already written a DialogFragment. Now I've realized that I want it to have a positive and a negative button just like an AlertDialog. How can I achieve such a thing while maintaining the code that I've written? public class DoublePlayerChooser extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL,0); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new

Using keyboard with stateAlwaysVisible, after touch any letter the showed AlertDialog opens selected, why?

心已入冬 提交于 2019-12-25 07:44:07
问题 I have only one button in my layout. The activity after count of 10 (five keyboard touchs) shows an AlertDialog . On Manifest the activity has the android:windowSoftInputMode="stateAlwaysVisible" , to always show the keyboard. The problem is that after touch any key on keyboard the only one button is kind selected. Like "highlighted" the entire button in blue. I could use below code on layout to solve the button problem: android:focusable="true" android:focusableInTouchMode="true" But for the

Show one progress dialog only at a time in android?

徘徊边缘 提交于 2019-12-25 03:04:52
问题 I wonder android support multiple dialog? Since when I first open the dialog. I allow user to click cancel, that will open one more dialog to confirm whether the user want to exit , the problem is if the user do not want to exit, the original dialog will disappear, how to fix the problem? Thanks public static ProgressDialog showProgressDialog(final Context ctx, boolean isCancelable) { ProgressDialog dialog = new ProgressDialog(ctx); dialog.setCancelable(false); dialog.setTitle(ctx