android-alertdialog

Checkbox in AlertDialog “pushed out” by TextView

淺唱寂寞╮ 提交于 2020-01-04 05:13:09
问题 I'm trying to create an AlertDialog to show an introduction message in my application, with a "Don't show this again" CheckBox below it. It works well when the message of the AlertDialog is short, but when is too long (requiring scrolling) the CheckBox is no longer shown. It gets "pushed out" by the TextView. The XML for the custom view (dont_show_again.xml): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=

How to create alertdialog programmatically in android

左心房为你撑大大i 提交于 2020-01-04 04:37:25
问题 In my android app i need to use alertdialog programmatically with two images in first row and another two images in second row. i seen some example like, CharSequence colors[] = new CharSequence[] {"red", "green", "blue", "black"}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a color"); builder.setItems(colors, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // the user clicked on colors[which] }

Is it possible to make a button on an AlertDialog that doesn't automatically close the dialog?

我的未来我决定 提交于 2020-01-04 02:53:26
问题 I have a simple list view with some check boxes in an alert dialog. I need to option to add a select all/none but you can't bring up the menu in an alert dialog, and I want to do this function from a button. From what I've seen any kind of button (positive, neutral, and negative) all close the dialog regardless. So, is this possible? If no, what alternatives do I have? My last mitigation is to simply create a new view and recreate everything. Is a new view the best solution? 回答1: So, is this

Style Radio Button and Text inside AlertDialog

青春壹個敷衍的年華 提交于 2020-01-04 02:34:09
问题 I want to show a radio list inside an AlertDialog with custom styling, something like . So I created a custom theme and provided that as an argument to AlertDialog.Builder's constructor. Here's the code for showing the dialog : private void showSortDialog() { final CharSequence[] options = new String[] {"Relevance", "Newest"}; AlertDialog.Builder builder = new AlertDialog.Builder(getActivityReference(), R.style.RadioDialogTheme); builder.setTitle("Sort by"); builder.setSingleChoiceItems

Dialog onCreateDialog(int dialogID)

岁酱吖の 提交于 2020-01-03 17:09:32
问题 To create the dialog, I'm overriding the following method: protected Dialog onCreateDialog(final int dialogId) { } and to call this, I'm using: showDialog(id); But now I want to use FragmentDialog , but there is no method like: protected Dialog onCreateDialog(final int dialogId) { } It has Dialog onCreateDialog(Bundle savedInstanceState){} My question is, how can I show dialogs based on different id's in FragmentDialog . 来源: https://stackoverflow.com/questions/12818342/dialog

Validation on EditText in alertDialog

依然范特西╮ 提交于 2020-01-03 16:52:38
问题 I am trying to add empty field validations on EditText on AlertDialog . But even after field is empty error message is not getting displayed, instead AlertDialog is closing. But if conditions are working well as I'm not able to do post operations if any of the field is empty. Here is my Java Sample code: public class TourActivity extends AppCompatActivity { private LayoutInflater inflater; private FloatingActionButton fab; @Override protected void onCreate(Bundle savedInstanceState) { super

Dialog with radio button save sharedpreferences but not the behaviour

你。 提交于 2020-01-03 05:13:10
问题 I can set the shared preferences in a AlertDialog with some radio buttons: public void ShowRadioDialog() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); final SharedPreferences.Editor editor = preferences.edit(); SharedPreferences choiceSettings = getSharedPreferences("currentChoice", 0); final int[] currentChoice = {choiceSettings.getInt("currentChoice", 0)}; final CharSequence[] items={"Rosso","Verde","Blu","Giallo","Arancione"}; AlertDialog.Builder

Android: startActivity() from AlertDialog

眉间皱痕 提交于 2020-01-02 14:50:34
问题 I am trying to use a Button in an AlertDialog to view a webpage. The problem is that this AlertDialog is located inside a class that extends ItemizedOverlay and doesn't extend Activity, so Eclipse underlines it and gives the following error: The method startActivity() is undefined for the type new DialogInterface.OnClickListener(){} I would like to launch activities from the PositiveButton, NeutralButton and NegativeButton, but I am not able to. In case you need more context, the main

Custom listview on AlertDialog multichoice

江枫思渺然 提交于 2020-01-02 11:15:34
问题 I would like to create AlertDialog same as on the picture: My code: adapter_book_desc.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:gravity="center_vertical" android:paddingLeft="15dip" android:layout_width="match_parent" android:layout_height="match_parent" > <CheckedTextView android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/text1" android:layout

Custom listview on AlertDialog multichoice

亡梦爱人 提交于 2020-01-02 11:15:05
问题 I would like to create AlertDialog same as on the picture: My code: adapter_book_desc.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:gravity="center_vertical" android:paddingLeft="15dip" android:layout_width="match_parent" android:layout_height="match_parent" > <CheckedTextView android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/text1" android:layout