0
我已經創建了一個圖層列表,但它並不完美。這裏是層列表中的Android XML:Android - 圖層列表橢圓形狀有額外的內線
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size
android:width="200dp"
android:height="200dp" />
<solid android:color="#5BB534" />
</shape>
</item>
<item
android:left="25dp"
android:top="25dp"
android:right="25dp"
android:bottom="25dp">
<shape>
<solid android:color="#4335BA" />
</shape>
</item>
<item
android:left="30dp"
android:top="30dp"
android:right="30dp"
android:bottom="30dp">
<shape
android:shape="ring"
android:thickness="20dp"
android:useLevel="false">
<solid android:color="#BFB637" />
</shape>
</item>
</layer-list>
,這裏是我在哪裏應用層列表:
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="Hello World!" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/mylayerlist"
android:layout_below="@id/tv"/>
下面是最終產品:
請注意,這條線粘在圓內。我只想要一個完美的圈子。我希望它看起來像這樣(或多或少,剛剛擺脫的小線伸出):
你能告訴我什麼樣的XML代碼塊所做的事:<項目 機器人:左= 「25dp」 機器人:頂部= 「25dp」 機器人:右= 「25dp」 android:bottom =「25dp」>具有這些邊界的項目究竟意味着什麼,這是否意味着創建一個具有此測量值的矩形? – j2emanue
矩形與填充25dp和視圖的大小。它應該使用你的方法,但它似乎是一個小錯誤 –