android利用xml實現(xiàn)分割線
因為沒有美工, 所以只能自己動手了。
在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新建一個xml
然后在 layout 里的布局文件里引用
這種方法 可以 多處引用同一個 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>
或者用填充的矩形實現(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" />
希望本文所述對大家學習Android軟件編程有所幫助。
- Android中控件GridView實現(xiàn)設置行列分割線的方法示例
- Android自定義DataGridView數(shù)據(jù)表格控件
- Android RecyclerView網(wǎng)格布局(支持多種分割線)詳解(2)
- android shape的使用及漸變色、分割線、邊框、半透明陰影
- 詳解Android中ListView實現(xiàn)圖文并列并且自定義分割線(完善仿微信APP)
- Android RecyclerView實現(xiàn)水平、垂直方向分割線
- Android修改DatePicker字體顏色及分割線顏色詳細介紹
- android中RecyclerView自定義分割線實現(xiàn)
- Android實現(xiàn)RecyclerView添加分割線的簡便方法
- Android使用GridView實現(xiàn)表格分割線效果
相關文章
解決Android應用冷啟動時出現(xiàn)的白屏問題的方法
本篇文章主要介紹了解決Android應用冷啟動時出現(xiàn)的白屏問題的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-08-08
Android制作登錄頁面并且記住賬號密碼功能的實現(xiàn)代碼
這篇文章主要介紹了Android制作登錄頁面并且記住賬號密碼功能的實現(xiàn)代碼,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-04-04
Android編程基于Contacts讀取聯(lián)系人的方法(附demo源碼)
這篇文章主要介紹了Android編程基于Contacts讀取聯(lián)系人的方法,實例分析了Contacts讀取的實現(xiàn)方法及權限設置方法,并附帶了完整實例供讀者下載參考,需要的朋友可以參考下2015-12-12
Android隨手筆記44之JSON數(shù)據(jù)解析
本文將主要介紹在Android開發(fā)中,如何在服務器端創(chuàng)建JSON數(shù)據(jù),以及如何在Android客戶端對JSON數(shù)據(jù)進行解析,對android json解析 相關知識感興趣的朋友一起學習吧2015-12-12
Android實現(xiàn)獲取應用程序相關信息列表的方法
這篇文章主要介紹了Android實現(xiàn)獲取應用程序相關信息列表的方法,是應用管理器常用的功能,需要的朋友可以參考下2014-07-07

