我想知道如何摆脱(或更改颜色)对话框中的标题分隔符。它是蜂窝设备上显示的对话框标题下方的一条蓝线。
我猜这是 SDK 中的相关布局,但由于没有样式属性,我不知道如何设置它的样式。如果我尝试使用 findViewById 则没有 android.R.id.titleDivider
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true">
<TextView android:id="@android:id/title" style="?android:attr/windowTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@android:dimen/alert_dialog_title_height"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:gravity="center_vertical|left" />
<View android:id="@+id/titleDivider"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="@android:color/holo_blue_light" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:foreground="?android:attr/windowContentOverlay">
<FrameLayout android:id="@android:id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</LinearLayout>
我尝试覆盖dialogTitleDecorLayout,它仅引用我的theme.xml中的dialog_title_holo.xml,但没有成功。错误是:
错误:错误:找不到与给定名称匹配的资源:attr
'dialogTitleDecorLayout'。
获取参考titleDivider
of AlertDialog
改变它的颜色:
int divierId = dialog.getContext().getResources()
.getIdentifier("android:id/titleDivider", null, null);
View divider = dialog.findViewById(divierId);
divider.setBackgroundColor(getResources().getColor(R.color.creamcolor));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)