How to set a shape's background in xml?

前端 未结 1 1873
悲哀的现实
悲哀的现实 2021-02-11 13:14

I just created a red circle using android shapes:




        
相关标签:
1条回答
  • 2021-02-11 13:20

    I think a layer-list might help you:

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    
        <item>
            <shape android:shape="rectangle" >
                <solid android:color="#ffffff" />
            </shape>
        </item>
        <item>
            <shape
                android:innerRadiusRatio="4"
                android:shape="ring"
                android:thicknessRatio="9"
                android:useLevel="false" >
                <solid android:color="#FF0000" />
                <size
                    android:height="48dip"
                    android:width="48dip" />
            </shape>
        </item>
    
    </layer-list>
    
    0 讨论(0)
提交回复
热议问题