Android編程實(shí)現(xiàn)圓角邊框的方法
本文實(shí)例講述了Android編程實(shí)現(xiàn)圓角邊框的方法。分享給大家供大家參考,具體如下:
設(shè)置邊框圓角可以在drawable-mdpi目錄里定義一個(gè)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的表示填充顏色,為了簡(jiǎn)單,這里用的是黑色。
而corners則是表示圓角,注意的是這里bottomRightRadius是左下角而不是右下角,bottomLeftRadius右下角。
當(dāng)然上面的效果也可以像下面一樣設(shè)置,如下:
如果想引用這個(gè)xml,只需要@drawable/corners_bg.xml即可:
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>
運(yùn)行結(jié)果:

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。
- Android布局實(shí)現(xiàn)圓角邊框效果
- Android實(shí)現(xiàn)圓角邊框?qū)υ捒虻姆椒?/a>
- Android 圓角邊框的實(shí)現(xiàn)方式匯總
- android layout 按比例布局的代碼
- android動(dòng)態(tài)加載布局文件示例
- android Activity相對(duì)布局的使用方法
- Android中RecyclerView布局代替GridView實(shí)現(xiàn)類似支付寶的界面
- Android TabLayout(選項(xiàng)卡布局)簡(jiǎn)單用法實(shí)例分析
- FrameLayout和Fragment處理Android應(yīng)用UI布局實(shí)例
- Android RelativeLayout相對(duì)布局屬性簡(jiǎn)析
- Android應(yīng)用借助LinearLayout實(shí)現(xiàn)垂直水平居中布局
- android動(dòng)態(tài)布局之動(dòng)態(tài)加入TextView和ListView的方法
- Android編程實(shí)現(xiàn)圓角邊框布局效果的方法
相關(guān)文章
Android實(shí)現(xiàn)在子線程中更新Activity中UI的方法
這篇文章主要介紹了Android實(shí)現(xiàn)在子線程中更新Activity中UI的方法,涉及Android線程與activity操作的相關(guān)技巧,需要的朋友可以參考下2016-04-04
Android實(shí)現(xiàn)選擇相冊(cè)圖片并顯示功能
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)選擇相冊(cè)圖片并顯示功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-04-04
Android編程實(shí)現(xiàn)播放視頻的方法示例
這篇文章主要介紹了Android編程實(shí)現(xiàn)播放視頻的方法,結(jié)合具體實(shí)例形式分析了Android使用VideoView類播放視頻的相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下2017-08-08
Android自定義View 實(shí)現(xiàn)鬧鐘喚起播放鬧鐘鈴聲功能
這篇文章主要介紹了Android自定義View 實(shí)現(xiàn)鬧鐘喚起播放鬧鐘鈴聲的效果,本文通過(guò)實(shí)例代碼給大家詳解,需要的朋友可以參考下2016-12-12
在Android中使用Anntation來(lái)代替ENUM的方法
本篇文章主要介紹了在Android中使用Anntation來(lái)代替ENUM的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-02-02
Android自定義webView頭部進(jìn)度加載效果
這篇文章主要介紹了Android自定義webView頭部進(jìn)度加載效果,小編畫一條進(jìn)度線,然后加載webview上面,具體實(shí)現(xiàn)代碼大家參考下本文2017-11-11
android 對(duì)話框彈出位置和透明度的設(shè)置具體實(shí)現(xiàn)方法
在android中我們經(jīng)常會(huì)用AlertDialog來(lái)顯示對(duì)話框。通過(guò)這個(gè)對(duì)話框是顯示在屏幕中心的。但在某些程序中,要求對(duì)話框可以顯示在不同的位置。2013-07-07
Android中Handler與Message的簡(jiǎn)單實(shí)例
這篇文章主要介紹了Android中Handler與Message的簡(jiǎn)單實(shí)例的相關(guān)資料,這里提供實(shí)例來(lái)說(shuō)明線程Handler與message 的結(jié)合使用,需要的朋友可以參考下2017-08-08
Android 浮動(dòng)編輯框的具體實(shí)現(xiàn)代碼
本篇文章主要介紹了Android 浮動(dòng)編輯框的具體實(shí)現(xiàn)代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-10-10

