简体   繁体   中英

Black bands on custom dialogs

I'm customizing an alert dialog, with a different 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.

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

Dialog with transparent background in Android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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