學(xué)習(xí)Android界面開(kāi)發(fā): Shape Drawable

<shape>

用于繪制幾何形狀(geometric shape)
支持以下屬性:

形狀 android:shape

  • rectangle 長(zhǎng)方形
  • ring 圓形
  • oval 橢圓形
  • line 直線

內(nèi)邊框填充 <padding>

當(dāng)Shape用作View的android:background時(shí),Shape的<padding>屬性將應(yīng)用于View。但是,當(dāng)View顯式設(shè)置了<padding>時(shí),Shape 的<padding>無(wú)效。

填充顏色 <solid>

填充漸變色 <gradient>

  • android:startColor 起始色
  • android:endColor 結(jié)束色
  • android:centerColor 中間色
  • android:centerX 橫向中間位置
  • android:centerY 縱向中間位置

注意:<solid>會(huì)覆蓋<gradient>屬性

筆劃 <stroke>

  • android:width 粗細(xì)
  • android:color 顏色
  • android:dashGap 虛線間的間隔
  • android:dashWidth 虛線的寬度

筆劃可以是實(shí)線或者虛線。
同時(shí)設(shè)置android:dashWidth和android:dashGap時(shí),筆劃為虛線。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容