1

背景をいくつかのドローアブルに設定した LinearLayout を使用したいと思います。

形状とグラデーションで行うことができるように、何とか角を丸くすることはできますか?

主な問題は、ビューのサイズと一致するようにビットマップを繰り返す必要があることです

4

2 に答える 2

1

これを試して、Xml アイテムに背景として追加します。

<?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >
          <solid android:color="#dadada"/> 
                 <corners
                       android:topLeftRadius="13dip"
                       android:topRightRadius="13dip"
                       android:bottomLeftRadius="13dip"
                       android:bottomRightRadius="13dip"/>
         <stroke android:width="1dip" android:color="#ff000000"/>
   </shape>

編集: LinearLayout で ImageView を定義し、その背景を丸みを帯びた形状に設定できます

ImageView IV=(ImageView)findViewById(R.id.imageView);
IV.setBackgroundResource(R.drawable.round_border); 
于 2013-01-29T15:16:04.630 に答える
0

これは、単一色の背景を使用している限り完全に機能する回避策です #000000 を背景色にする必要があります。

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <bitmap android:src="@drawable/action_bar_background" android:tileMode="repeat"/>        
    </item>    
    <item>
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <stroke
                android:width="5dp"
                android:color="#000000" />

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

            <corners android:radius="7dp" >
            </corners>
        </shape>
    </item>    
        <item>
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <stroke
                android:width="5dp"
                android:color="#000000" />

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

        </shape>
    </item>
</layer-list>
于 2013-01-30T10:56:07.320 に答える