国产探花免费观看_亚洲丰满少妇自慰呻吟_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程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黄陵县| 奉贤区| 三门峡市| 江门市| 札达县| 兴仁县| 扶沟县| 定西市| 武鸣县| 海伦市| 彝良县| 临海市| 文山县| 北辰区| 东山县| 琼中| 沙坪坝区| 安新县| 河津市| 吴堡县| 吴川市| 韩城市| 连城县| 怀远县| 兴宁市| 荃湾区| 大安市| 衡阳县| 什邡市| 高阳县| 沧州市| 和顺县| 札达县| 怀化市| 紫金县| 保定市| 兴山县| 盐池县| 鄂伦春自治旗| 安图县| 大埔县|