Android中的Shape使用總結

來源:互聯網
上載者:User

標籤:

solid:填充
android:color指定填充的顏色

 

gradient:漸層
android:startColor和android:endColor分別為起始和結束顏色,

android:angle是漸層角度,必須為45的整數倍。
另外漸層預設的模式為android:type="linear",即線性漸層,

可以指定漸層為放射狀漸層,android:type="radial",放射狀漸層需要指定半徑android:gradientRadius="50"。

angle值對應的位置

 

stroke:描邊
android:width="2dp" 描邊的寬度,android:color 描邊的顏色。
我們還可以把描邊弄成虛線的形式,設定方式為:
android:dashWidth="5dp" 
android:dashGap="3dp"
其中android:dashWidth表示‘-‘這樣一個橫線的寬度,android:dashGap表示之間隔開的距離

corners:圓角
android:radius為角的弧度,值越大角越圓。
我們還可以把四個角設定成不同的角度,

同時設定五個屬性,則Radius屬性無效

android:Radius="20dp"                           設定四個角的半徑

android:topLeftRadius="20dp"              設定左上方的半徑 
android:topRightRadius="20dp"           設定右上方的半徑 
android:bottomLeftRadius="20dp"      設定右下角的半徑 
android:bottomRightRadius="20dp"    設定左下角的半徑

padding:間隔
可以設定上下左右四個方向的間隔

 

Android中的Shape使用總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.