【问题标题】:android: customized dialog - round corners and customized backgroundandroid:自定义对话框 - 圆角和自定义背景
【发布时间】:2013-12-27 15:16:40
【问题描述】:

对话框布局xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@android:color/blue" />

    <stroke
        android:width="7dp"
        android:color="@color/white" />

    <corners android:radius="35px" />

    <padding
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp" />

</shape>

问题:

上面的代码只是简单地制作了一个用纯蓝色填充的圆角对话框。
我想问一下如何修改上述内容,使对话框仍然具有圆角,但使用自定义的 png 作为背景,而不是纯色?

谢谢!

【问题讨论】:

    标签: android xml dialog customization


    【解决方案1】:

    您始终可以使用图层列表来执行此操作。更多信息:Layer-list

    或在布局中声明图像视图,以您的形状为背景且无颜色

    【讨论】:

    • 我现在已经在我的布局中使用android:background="@drawable/layout_round_corners_white_boarder_fill_candies" 等等...如何为形状添加背景...
    猜你喜欢
    • 2012-11-20
    • 2014-03-13
    • 2017-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-09
    • 1970-01-01
    相关资源
    最近更新 更多