android利用xml實(shí)現(xiàn)分割線
因?yàn)闆]有美工, 所以只能自己動(dòng)手了。
在layout文件夾里的xml 寫
方法1:在layout里面的布局xml 文件里加上面的代碼
<View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/orange_normal" />
效果圖

在drawable文件夾里用 shape line 或 rectangle 先畫線
方法2:在drawable里面用shape新建一個(gè)xml
然后在 layout 里的布局文件里引用
這種方法 可以 多處引用同一個(gè) line 樣式
<!-- drawable/line_my.xml --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:color="@color/orange_normal" /> </shape>
或者用填充的矩形實(shí)現(xiàn)
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="@color/orange_normal" /> <size android:height="1dp" android:width="100dp" /> </shape>
Note
android:width=”100dp” 不能賦值為 “match_parent”
在layout/bomb_fragment.xml 里面引用
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/line_my" />
希望本文所述對(duì)大家學(xué)習(xí)Android軟件編程有所幫助。
- Android中控件GridView實(shí)現(xiàn)設(shè)置行列分割線的方法示例
- Android自定義DataGridView數(shù)據(jù)表格控件
- Android RecyclerView網(wǎng)格布局(支持多種分割線)詳解(2)
- android shape的使用及漸變色、分割線、邊框、半透明陰影
- 詳解Android中ListView實(shí)現(xiàn)圖文并列并且自定義分割線(完善仿微信APP)
- Android RecyclerView實(shí)現(xiàn)水平、垂直方向分割線
- Android修改DatePicker字體顏色及分割線顏色詳細(xì)介紹
- android中RecyclerView自定義分割線實(shí)現(xiàn)
- Android實(shí)現(xiàn)RecyclerView添加分割線的簡便方法
- Android使用GridView實(shí)現(xiàn)表格分割線效果
相關(guān)文章
Android Gradle Build Error:Some file crunching failed, see l
這篇文章主要介紹了Android Gradle Build Error:Some file crunching failed, see logs for details解決辦法的相關(guān)資料,需要的朋友可以參考下2016-11-11
Android開發(fā)人臉識(shí)別統(tǒng)計(jì)人臉數(shù)
這篇文章主要介紹了Android開發(fā)人臉識(shí)別統(tǒng)計(jì)人臉數(shù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-10-10
Android實(shí)現(xiàn)手勢(shì)劃定區(qū)域裁剪圖片
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)手勢(shì)劃定區(qū)域裁剪圖片,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-05-05
Android Studio 3.6 layout文件text模式切換問題
這篇文章主要介紹了Android Studio 3.6 layout文件text模式切換問,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-03-03
安卓(android)怎么實(shí)現(xiàn)下拉刷新
這里我們將采取的方案是使用組合View的方式,先自定義一個(gè)布局繼承自LinearLayout,然后在這個(gè)布局中加入下拉頭和ListView這兩個(gè)子元素,并讓這兩個(gè)子元素縱向排列。對(duì)安卓(android)怎么實(shí)現(xiàn)下拉刷新的相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2016-04-04
Android 動(dòng)態(tài)加載二維碼視圖生成快照的示例
本篇文章主要介紹了Android 動(dòng)態(tài)加載二維碼視圖生成快照的示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-10-10
從源碼分析Android的Glide庫的圖片加載流程及特點(diǎn)
這篇文章主要介紹了從源碼分析Android的Glide庫的圖片加載流程及特點(diǎn),Glide庫是Android下一款人氣很高的多媒體資源管理庫,特別是在處理gif加載方面受到眾多開發(fā)者青睞,需要的朋友可以參考下2016-04-04
Android?Gradle?插件自定義Plugin實(shí)現(xiàn)注意事項(xiàng)
這篇文章主要介紹了Android?Gradle?插件自定義Plugin實(shí)現(xiàn)注意事項(xiàng),文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的朋友可以參考一下2022-06-06
Android編程實(shí)現(xiàn)播放MP3功能示例
這篇文章主要介紹了Android編程實(shí)現(xiàn)播放MP3功能,結(jié)合實(shí)例形式分析了Android播放MP3功能的界面布局與功能實(shí)現(xiàn)相關(guān)操作技巧,需要的朋友可以參考下2017-02-02
Android實(shí)現(xiàn)定時(shí)器的3種方法
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)定時(shí)器的3種方法,感興趣的小伙伴們可以參考一下2016-07-07

