大佬教程收集整理的这篇文章主要介绍了Android使用LinearLayout设置边框,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
找到好多人的,都是文章随便copy,自己都不验证下,特别说LinearLayout中可以设置他的divider属性的,我在Android studio中试了,根本显示不出来,这边是csdn上一个朋友回答的,我收藏了,放到这里,后面备用。
1.定一个underline的xml文件,把它放到drawable下
underline.xml
<?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://scheR_388_11845@as.android.com/apk/res/android" > <!-- 连框颜色值 --> <item> <shape> <solid android:color="#dddddd" /> </shape> </item> <!-- 主体背景颜色值 --> <item android:bottom="1dp"> <!--设置只有底部有边框--> <shape> <solid android:color="#ffffff" /> </shape> </item> </layer-list>
2.然后在LinearLayout中引用该布局。就会出现下边框
<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.实现的效果图如下:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程小技巧。
以上是大佬教程为你收集整理的Android使用LinearLayout设置边框全部内容,希望文章能够帮你解决Android使用LinearLayout设置边框所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。