【发布时间】:2012-06-14 06:35:37
【问题描述】:
我想知道如何在对话框中摆脱(或更改颜色)titleDivider。它是蜂窝+设备上显示的对话框标题下方的蓝线。
我猜这是来自 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>
我试图覆盖在我的 theme.xml 中仅引用 dialog_title_holo.xml 的 dialogTitleDecorLayout,但没有成功。错误是:
错误:错误:找不到与给定名称匹配的资源:attr 'dialogTitleDecorLayout'。
【问题讨论】:
-
如果你想摆脱默认样式的某些部分,你必须完全删除它,因为它因设备和操作系统版本而异
-
张贴你的截图@Sharad Mhaske
-
@GrlsHu:截图我发了
-
看我的编辑回答,它会帮助你
-
您始终可以使用自定义布局。设计您的自定义布局并将其放入 inn dailog