Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Android Holo Theme style dialog box buttons

I'm creating a Dialog Box on Holo Theme and want to follow the OS default way of displaying the buttons. So far I have created the dialog box but the buttons don't render in the way it does in the apps done in Holo for ICS. How can I do this? My intended look & feel is No. 3rd in this image and I am able to reach till here Notice the Signup and Login buttons

like image 269
kishu27 Avatar asked Mar 21 '12 11:03

kishu27


1 Answers

a bit late, but maybe someone is still interested in that.

this works pretty good for me.

... <!-- EDIT: be carefull, "?android:attr/dividerHorizontal" is only supported since API 11       just avoid it in prior OSs. --> <View     android:layout_width="fill_parent"     android:layout_height="1dip"     android:background="?android:attr/dividerHorizontal" /> <LinearLayout      style="?android:attr/buttonBarStyle"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:orientation="horizontal"     android:paddingTop="0dip"     android:paddingLeft="2dip"     android:paddingRight="2dip"     android:measureWithLargestChild="true">      <Button          android:id="@+id/cancel"         style="?android:attr/buttonBarButtonStyle"         android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="1"         android:text="@android:string/cancel"/>     <Button          android:id="@+id/ok"         style="?android:attr/buttonBarButtonStyle"         android:layout_width="0dip"         android:layout_height="wrap_content"         android:layout_weight="1"         android:text="@android:string/ok"/> </LinearLayout> ... 

the activity that loads this layout needs the Holo.Dialog theme.

android:theme="@android:style/Theme.Holo.Dialog" 
like image 96
SimonSays Avatar answered Sep 29 '22 06:09

SimonSays