国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android編程實現圓角邊框的方法

2020-04-11 11:18:43
字體:
來源:轉載
供稿:網友

本文實例講述了Android編程實現圓角邊框的方法。分享給大家供大家參考,具體如下:

設置邊框圓角可以在drawable-mdpi目錄里定義一個xml:

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#000000" /> <corners android:topLeftRadius="10dp"    android:topRightRadius="10dp"    android:bottomRightRadius="10dp"    android:bottomLeftRadius="10dp"/></shape>

解釋:solid的表示填充顏色,為了簡單,這里用的是黑色。

而corners則是表示圓角,注意的是這里bottomRightRadius是左下角而不是右下角,bottomLeftRadius右下角。

當然上面的效果也可以像下面一樣設置,如下:

復制代碼 代碼如下:
<corners android:radius="5dp" />

如果想引用這個xml,只需要@drawable/corners_bg.xml即可:

復制代碼 代碼如下:
android:background="@drawable/corners_bg"

main.xml:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:orientation="vertical" android:layout_width="fill_parent"  android:layout_height="fill_parent" android:background="#FFFFFF">  <RelativeLayout android:id="@+id/login_div"   android:layout_width="fill_parent" android:layout_height="150dip"   android:padding="15dip" android:layout_margin="15dip"   android:background="@drawable/corners_bg">  </RelativeLayout> </LinearLayout>

運行結果:

希望本文所述對大家Android程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 云林县| 象山县| 鄂伦春自治旗| 甘谷县| 巫溪县| 米林县| 苏州市| 吉安市| 泸溪县| 彭州市| 梁山县| 衢州市| 卢湾区| 宁国市| 迁西县| 云梦县| 精河县| 沅陵县| 五台县| 滁州市| 三门峡市| 麟游县| 西城区| 太谷县| 祁门县| 黄骅市| 佛学| 苍溪县| 五大连池市| 张家港市| 巴楚县| 四川省| 读书| 高雄县| 武义县| 景洪市| 龙泉市| 阳朔县| 德清县| 黎平县| 宜宾市|