如何设置标题和对话框内容之间的蓝色分隔线(请参见截图)?如何自定义Android ICS样式对话框中的行
我更喜欢通过xml来做到这一点,但如果有必要,我会采取一个程序化的解决方案。
我已经浏览了android-15的默认styles.xml和themes.xml,但是我找不到任何东西。
如何设置标题和对话框内容之间的蓝色分隔线(请参见截图)?如何自定义Android ICS样式对话框中的行
我更喜欢通过xml来做到这一点,但如果有必要,我会采取一个程序化的解决方案。
我已经浏览了android-15的默认styles.xml和themes.xml,但是我找不到任何东西。
如果您正在使用ActionBarSherlock你可以通过查看检查出来abs_dialog_title_holo.xml。在那里您会看到蓝线是通过视图定义的分隔线:
<View android:id="@+id/abs__titleDivider"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="@color/abs__holo_blue_light" />
谢谢。那么如果不更改ABS的某些部分,就无法对其进行定制? – benvd 2012-07-10 09:16:25
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<TextView android:id="@android:id/title" style="?android:attr/windowTitleStyle"
android:layout_width="match_parent"
android:layout_height="30dp"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:gravity="center_vertical|left"
android:text="Dialog"
android:textColor="@Color/blue"/>
<View android:id="@+id/titleDivider"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="@Color/blue" />
<TextView android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:gravity="center_vertical|left"
android:textColor="@android:color/white"
android:text="Your Text"/>
</LinearLayout>
集此XML作为类的内容,并在清单文件中添加以下线下活动:
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
创建自定义对话框。 – AkashG 2012-07-10 07:21:47
你有没有得到所需的解决方案? – AkashG 2012-07-11 09:10:14
我想要做同样的事情。最后你决定了什么? – bencallis 2012-07-27 19:29:04