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 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



来源:https://stackoverflow.com/questions/11253345/dialog-themed-activity-positive-and-negative-buttons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!