【问题标题】:How can I set my outside shape's background in xml? transparent circle如何在 xml 中设置外部形状的背景?透明圆圈
【发布时间】:2014-08-22 20:22:04
【问题描述】:

如何在白色矩形中制作带有透明圆圈的布局样式?

如果我使圆形背景透明,那么我只看到白色矩形(我知道为什么),有什么可能的解决方案吗? 像这样 : screenshot http://ipicture.kz/images/2014/07/6eijxdbpjjsstuularkx.jpg (无边框)

【问题讨论】:

  • 恐怕不在 xml 中
  • 其他两种方式然后样式:1.您可以将这样的图像设置为布局背景2.您可以创建xml Drawable并设置为布局背景
  • 你可以用9个补丁

标签: android layout styles


【解决方案1】:

创建一个 xml-drawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle"
            android:useLevel="false">

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

        </shape>
    </item>
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"

            android:shape="ring"
            android:thicknessRatio="2"
            android:innerRadius="0dp"
            android:useLevel="false">

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

        </shape>
    </item>
</layer-list>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-14
    • 2013-07-01
    • 2018-11-23
    • 2012-03-05
    • 2020-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多