I am developing an application in android, where i would like to shrink the size of the default alertdialog. How can i set the size of an AlertDialog in Android?
Asked
Active
Viewed 247 times
0
-
have you tried this? http://stackoverflow.com/questions/8835931/size-of-alert-dialog-or-custom-alert-dialog – Amir.F Aug 08 '13 at 11:34
-
Thank you for your super fast response. Let me try. – Udit Shah Aug 08 '13 at 11:38
1 Answers
0
You can set your own XML layout for a dialog (example below called species_prompt), then call
speciesDialog.setContentView(R.layout.species_prompt);
TextView text = (TextView) speciesDialog
.findViewById(R.id.specieshelptext);
in your dialog method, calling each view appropriately (I only provide one example above...)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_gravity="center_horizontal">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:id="@+id/specieshelptext" android:textColor="#FFF"
android:paddingLeft="5dip" android:paddingRight="5dip"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button android:id="@+id/specieshelpbutton"
android:layout_gravity="center_horizontal" android:layout_below="@id/ScrollView01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1.0" android:layout_centerHorizontal="true"
android:text="Grab species now..." />
<Button android:id="@+id/speciesdismissButton" android:text="Cancel"
android:layout_gravity="center_horizontal" android:layout_height="wrap_content"
android:layout_width="wrap_content" />
</LinearLayout>
</ScrollView>

iaindownie
- 1,046
- 12
- 28