android shape 圓角矩形 圓環畫法

2021-08-07 01:54:08 字數 2557 閱讀 6699

圓環就是在圓形的基礎上進行圓環厚度設定,所以我們先看一下圓形的基礎畫法
//圓形畫法
<shapexmlns:android=""android:shape="oval">

<solidandroid:color="@android:color/white">solid> //背景設定

<sizeandroid:height="20dp"android:width="20dp">size> //設定寬高

shape>

//圓環畫法
<shapexmlns:android=""android:shape="oval">

<sizeandroid:width="10dp"android:height="10dp">size> //設定圓總寬高

<strokeandroid:width="2dp" //設定圓環的厚度android:color="@android:color/holo_red_light">stroke>

shape>

//圓角矩形畫法
<shapexmlns:android=""android:shape="rectangle">

<solidandroid:color="@android:color/holo_green_dark">solid>

<sizeandroid:height="10dp"android:width="24dp">size>

<cornersandroid:topleftradius="180dp" //設定左上角弧度android:toprightradius="180dp" //設定右上角弧度android:bottomleftradius="180dp"//設定左下角弧度android:bottomrightradius="180dp"//設定右下角弧度

>corners>

shape>

android shape實現邊框圓角

1.在drawable 下新建 shape.xml 檔案 android radius為角的弧度,值越大角越圓。我們還可以把四個角設定成不同的角度,方法為 2.設定引用 android background drawable shape edittext 其它屬性 android hint 請輸入使...

Android Shape自定義純色圓角按鈕

在android開發中,為響應美化應用中控制項的效果,使用shape定義圖形效果,可以解決過多的問題。首先看一下效果圖 整個頁面布局為 首先我們看看這個自定義的樣式 其中重點關注的就是它的backgroud屬性了。selector red corners button.xml shape red c...

Android shape使用詳解

一 在res drawable資料夾下建立乙個名為gradient box的xml檔案 xmlns android android shape rectangle android radius 8dp android topleftradius 5dp android toprightradius ...