添加一个button,希望它的形状是圆形的,还要有大小、背景的属性
<?xml version="1.0" encoding="utf-8"?>
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
android:id="@+id/roundButton"
android:text=" 圆角按钮 "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape"
/>
<?xml version="1.0" encoding="UTF-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
按照楼上给你的写或者直接UI给你切一张圆形的图片,然后用作button的背景
在drawable里创建一个xml然后写
<?xml version="1.0" encoding="utf-8"?>
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
android:id="@+id/roundButton"
android:text=" 圆角按钮 "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape"
/>
然后再layout里面写
<?xml version="1.0" encoding="UTF-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>