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

android Shape Drawable创建两边半圆的按钮背景

2016-03-01 12:59 686 查看
<?xml version="1.0" encoding="utf-8"?>  

<shape xmlns:android="http://schemas.android.com/apk/res/android"   

    android:shape="rectangle">  

    <!-- 填充颜色 -->  

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

    <!-- 线的宽度,颜色灰色 -->  

    <stroke android:width="1dp" android:color="#63a219"></stroke>          

    <!-- 矩形的圆角半径 -->  

    <corners android:radius="10dp" />         

</shape>

?xml
version="1.0"
encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"

    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:text="Hello
World!"

        android:id="@+id/tv1"
        android:background="@drawable/semi_round_backgroud"

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:layout_centerInParent="true"
        android:textSize="25dp"

        android:paddingTop="8dp"
        android:paddingBottom="8dp"

        android:paddingRight="15dp"
        android:paddingLeft="15dp"/>

 

</RelativeLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: