Search code examples
androidandroid-dialogandroid-theme

Dialog themed activity : positive and negative buttons


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?


Solution

  • Alright, if you're developping an application for HC/ICS, without Sherlock, the answer is here : https://gist.github.com/2348305

    Just theme using

    style="?android:attr/buttonBarStyle"
    

    for container,

    style="?android:attr/buttonBarButtonStyle"
    

    for buttons

    and

    android:divider="?android:attr/dividerHorizontal"
    android:showDividers="middle"
    

    for the root layout