0
点赞
收藏
分享

微信扫一扫

LinearLayout设置白色背景、灰色边框、倒圆角

读思意行 2022-08-23 阅读 135


1.首先在res-->drawable目录下新建一个xml文件,类型选择drawable,命名layout_border.xml,在其中写入以下代码:


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<solid android:color="#FFFFFF" />

<stroke
android:width="0.01dp"
android:color="#BFBFBF" />

<!-- 这个可以不加,padding用不上
<padding
android:bottom="1dp"
android:left="0.5dp"
android:right="0.5dp"
android:top="0dp" /> -->
<!-- 圆角
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" /> -->

</shape>



2.在要设置边框的控件xml命令里加入:android: ​​background=“@​​

drawable ​​/layout_border​​




举报

相关推荐

0 条评论