次のような Android の「Spinner」要素を作成しました。
<Spinner
android:id="@+id/choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:background="@drawable/cell_shape"
android:gravity="center"
android:padding="3dp"
android:text="Choice"
android:textColor="@android:color/holo_orange_dark" />
cell_shape.xml は次のようになります。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#99CC3300"/>
<corners android:radius="10px"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>
角が丸い「Spinner-Elements」を表示するための「custom_spinner.xml」ファイルを作成します。
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/cell_shape"
android:textColor="#988767" >
</TextView>
「Spinner-Element」を表示するには、次のコードを使用します。
Spinner spinner = (Spinner) table.findViewById(R.id.choice);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.planets_array, R.layout.custom_spinner);
adapter.setDropDownViewResource(R.layout.custom_spinner);
spinner.setAdapter(adapter);
問題は、スピナーの要素アイテムも角が直角になっていることです。「TextView」のみが角を丸めているようですが、スピナー要素自体は丸くなっていないようです。
ここで何が問題なのですか?間違った要素タイプを使用しただけですか?
よろしく