您的位置:首页 > 移动开发 > Android开发

Android中自定义圆角边框

2016-10-14 15:35 232 查看
在drawable目录下自定义一个border.xml文件,步骤如下:

选择drawable—>new—>drawable Resourse file—>更改Root element 为shape

Filename 为border。

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

<stroke
android:width="0.4dp"
android:color="#bfb9b9" />
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"/>
<padding
android:bottom="1dp"
android:left="0.5dp"
android:right="0.5dp"
android:top="1dp" />
</shape>


在需要加边框的布局中加入:
Android:background=“@drawable/border.xml”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android