14

右上隅と左下隅を丸くした ImageView が必要です。

<corners 
android:topRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topLeftRadius="0dp"
android:bottomRightRadius="0dp"/>

上記のコードを試してみましたが、うまくいきません。助けてください!

4

2 に答える 2

5
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@android:color/darker_gray"/>
<corners android:topRightRadius="10dp"
    android:bottomRightRadius="0dp"
    android:topLeftRadius="0dp"
    android:bottomLeftRadius="10dp"/>

</shape>

これは、drawable フォルダーにある私の drawable shape.xml です。そして、このドローアブルを使用してイメージビューの背景を設定しています。

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher"
    android:background="@drawable/shape"/>

デバイス/エミュレーターでアプリを実行すると表示されます (xml グラフィカル レイアウトには表示されません)。

于 2012-09-10T06:58:13.330 に答える
2

私はこれを使用していますそれは私にとってはうまくいきます

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

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

        <corners
            android:bottomLeftRadius="10dp"
            android:bottomRightRadius="10dp"
            android:topLeftRadius="0dp"
            android:topRightRadius="0dp" />

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

    </shape>
于 2012-09-10T07:00:38.900 に答える