简体   繁体   English

自定义对话框上的黑带

[英]Black bands on custom dialogs

I'm customizing an alert dialog, with a different UI. 我正在使用不同的UI自定义警报对话框。 Here is an example. 这是一个例子。

在此处输入图片说明

As you can see there are two black bands (highlighted with red rectangulars) I would like to remove. 如您所见,有两个我要删除的黑带(用红色矩形突出显示)。

It weird because the main layout show match the parent one, as you can see from the xml below. 这很奇怪,因为主布局显示与父布局匹配,如下面的xml所示。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lytDialog_takeNowDialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/default_side_space"
android:layout_marginRight="@dimen/default_side_space"
android:background="@color/yellow"
android:orientation="vertical" >

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top|center_horizontal"
    android:gravity="center"
    android:padding="@dimen/default_side_space"
    android:text="Are you sure?"
    android:textColor="@color/dialog_text_color"
    android:textSize="@dimen/dialog_text_size" />

<LinearLayout
    android:id="@+id/lytShowAlert_takeNowDialog"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/black_gradient"
    android:orientation="horizontal"
    android:padding="@dimen/default_side_space" android:visibility="gone">

    <CheckBox
        android:id="@+id/chkShowAlert_takeNowDialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="5dp"
        android:text="@string/dont_show_alert"
        android:textColor="@android:color/white"
        android:textSize="@dimen/dialog_yes_no_size" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:weightSum="1" >

    <Button
        android:id="@+id/no_dialog"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/space_among_buttons"
        android:layout_weight=".5"
        android:background="@drawable/yellow_gradient"
        android:padding="@dimen/default_side_space"
        android:text="No"
        android:textColor="@color/dialog_text_color"
        android:textSize="@dimen/dialog_yes_no_size" />

    <Button
        android:id="@+id/yes_dialog"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/space_among_buttons"
        android:layout_weight=".5"
        android:background="@drawable/yellow_gradient"
        android:padding="@dimen/default_side_space"
        android:text="Yes"
        android:textColor="@color/dialog_text_color"
        android:textSize="@dimen/dialog_yes_no_size" />
</LinearLayout>

Anyone knows the solution to remove them please? 有人知道将其删除的解决方案吗?

If you want to remove black panel, change the appTheme(Actually dialog theme.). 如果要删除黑色面板,请更改appTheme(实际上是对话框主题。)。

Dialog with transparent background in Android Android中具有透明背景的对话框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM