Android使用LinearLayout設(shè)置邊框
找到好多人的,都是文章隨便copy,自己都不驗證下,特別說LinearLayout中可以設(shè)置他的divider屬性的,我在Android Studio中試了,根本顯示不出來,這邊是csdn上一個朋友回答的,我收藏了,放到這里,后面?zhèn)溆谩?/p>
1.定一個underline的xml文件,把它放到drawable下
underline.xml
<?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 連框顏色值 --> <item> <shape> <solid android:color="#dddddd" /> </shape> </item> <!-- 主體背景顏色值 --> <item android:bottom="1dp"> <!--設(shè)置只有底部有邊框--> <shape> <solid android:color="#ffffff" /> </shape> </item> </layer-list>
2.然后在LinearLayout中引用該布局。就會出現(xiàn)下邊框
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_marginRight="5dp" android:layout_marginLeft="5dp" android:paddingBottom="5dp" android:paddingTop="5dp" android:paddingRight="5dp" android:background="@drawable/linearlayout_underline" android:layout_height="wrap_content"> <TextView android:text="余額:5611.19元" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/red_font" android:textSize="18dp" android:id="@+id/member_balance" android:layout_weight="1" android:textAlignment="textEnd"/> </LinearLayout>
3.實現(xiàn)的效果圖如下:
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Android 滑動返回Activity的實現(xiàn)代碼
這篇文章主要介紹了Android 滑動返回Activity的實現(xiàn)代碼的相關(guān)資料,這里是訪微信滑動返回主頁的功能,需要的朋友可以參考下2017-07-07用Android Studio3.0新功能加快構(gòu)建速度
本文主要介紹了使用Android Studio3.0新功能,加快Android Studio的構(gòu)建速度等相關(guān)做法。2017-11-11Android之聯(lián)系人PinnedHeaderListView使用介紹
Android聯(lián)系人中的ListView是做得比較獨特的,這幾天,我把他提取出來了,寫成一個簡單的例子,留著備用,感興趣的朋友可以參考下哈2013-06-06RecyclerView嵌套RecyclerView滑動卡頓的解決方法
這篇文章主要為大家詳細介紹了RecyclerView嵌套RecyclerView滑動卡頓的解決方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-12-12