Android圆角矩形

1.在drawable中创建shape_round文件

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

    <!-- 设置透明背景色 -->
    <solid android:color="#ffffffff" />

    <!-- 设置一个蓝边框 -->
    <stroke android:width="1dp" android:color="#ff1296db" />
    <corners android:topLeftRadius="2dp"
        android:topRightRadius="2dp"
        android:bottomRightRadius="2dp"
        android:bottomLeftRadius="2dp"/>
    <!-- 设置四个圆角的半径 -->
    <corners
        android:bottomLeftRadius="20px"
        android:bottomRightRadius="20px"
        android:topLeftRadius="20px"
        android:topRightRadius="20px" />
    <!-- 设置一下边距,让空间大一点 -->
    <padding
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp"
        android:top="10dp" />

</shape>

2、使用样式

 <TextView
            android:id="@+id/textview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/shape_round_press_false"/>


---------------------
作者:如果你也听说-小烨
来源:CSDN
原文:https://blog.csdn.net/yangye608/article/details/74910095
版权声明:本文为博主原创文章,转载请附上博文链接!

posted @ 2018-10-17 20:26  zhaogaojian  阅读(283)  评论(0编辑  收藏  举报