1

私は次のようなスピナーを作成しました

スピナー

私のレイアウトファイルは次のとおりです。

<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/round_corners"
        android:padding="7dip" >

        <Spinner
            android:id="@+id/select_city"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:prompt="@string/selectCity" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="14dp"
            android:text="@string/City"
            android:textColor="@color/dark_grey"
            android:textSize="18dp" />
    </RelativeLayout>

私が欲しいのは、スピナーの背景を透明にし、それでも下向きの矢印を表示することです。これを行う方法はありますか?

4

3 に答える 3

3

xmlファイルを作成し、ドローアブルフォルダに配置します。

<?xml version="1.0" encoding="utf-8"?>
  <selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true"
       android:drawable="@drawable/slim_spinner_pressed" />
 <item android:drawable="@drawable/slim_spinner_normal" />
</selector>

<Spinner ..... android:background="@drawable/selector_slim_spinner" ..... />

詳細については、 Androidでこの変更スピナースタイルを確認してください

于 2012-11-21T09:34:48.200 に答える
0

スレクターを作成し、そのセレクターをスピナーの背景として指定する必要があります

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_pressed="true"
           android:drawable="@drawable/..." />
     <item android:drawable="@drawable/..." />
</selector>
于 2012-11-21T09:38:23.980 に答える
0

このリソースAndroidHoloColors Generatorを使用して、 Android4.0などのAndroidコンポーネントを生成できます。

于 2012-11-21T09:42:36.440 に答える