2012-01-04 83 views

回答

4

你可以为每个做Shape文件。只需为特定按钮定义角半径并使用它即可创建Shape文件。

例如顶部按钮1

设置按钮的背景像这样

<Button android:id="@+id/btn1" android:text="Click" android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:background="@drawable/mycorner"/> 

创建绘制文件夹不同形状不同的XML文件喜欢这里mycorner.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <corners android:bottomLeftRadius="8dip" 
       android:topRightRadius="8dip" 
       android:topLeftRadius="1dip" 
       android:bottomRightRadius="1dip" 
       /> 
    <padding android:left="5dp" android:right="5dp" android:top="5dp" android:bottom="5dp" /> 
    <gradient android:startColor="#ffffff" android:endColor="#ffffff" /> 
</shape> 
+0

谢谢你,我会试试这个。 – blinduck 2012-01-04 13:19:45