2017-04-11 11 views

答えて

1

あなたは、このように描画可能を追加して、あなたの背景のためにそれを使用することができます。

<?xml version="1.0" encoding="utf-8"?> 
<selector 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item> 
     <shape> 
      <stroke android:width="2px" android:color="#000000"/> 
      <corners android:radius="10.0dip" /> 
     </shape> 
    </item> 
</selector> 

あなたが描画可能形状hereについてのより多くの例と説明を見つけることができます。

1

あなたはボタンのこの種の描画可能なを作成することができ、

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

    <stroke android:width="1dp" 
     android:color="@color/grey_text"/> 

    <gradient android:startColor="@android:color/transparent" 
     android:endColor="@android:color/transparent" 
     android:angle="90"/> 
</shape> 
1

2本使用Button Sとの両方のために異なる背景ドローアブルを作成します。

左ボタンの背景:

<?xml version="1.0" encoding="utf-8"?> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android"> 
     <stroke 
      android:width="1dp" 
      android:color="#ffffff" /> 
     <corners 
      android:bottomLeftRadius="4dp" 
      android:topLeftRadius="4dp" /> 
    </shape> 

右ボタンの背景:

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <stroke 
     android:width="1dp" 
     android:color="#ffffff" /> 
    <corners 
     android:bottomRightRadius="4dp" 
     android:topRightRadius="4dp" /> 
</shape> 
関連する問題