2010-01-14 118 views

回答

12

整件事是一個單一的9貼片PNG圖像。我之前通過替換圖像修改了spinners的整個外觀。看到這個頁面:http://androiddrawableexplorer.appspot.com/

具體看btn_dropdown_normal.9,btn_dropdown_pressed.9,btn_dropdown_selected.9和btn_dropdown_disabled.9

你只需要提供自己的這些圖像的版本。

+0

就是這樣?非常感謝你! – LambergaR 2010-01-14 22:12:21

+0

如何改變這從android.jar.Can你給我任何想法? 謝謝 – BIBEKRBARAL 2010-02-21 11:29:50

+0

您的鏈接導致404錯誤。 -1 – 2012-04-23 17:19:16

0

此外,您還可以將您的「微調欄」佈局中的FrameLayout,再加上真正的微調,但設置爲不可見:

<FrameLayout 
     android:layout_width="fill_parent" 
     android:layout_height="32dip" 
     > 
     <Spinner 
      android:id="@+id/theSpinner" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:visibility="invisible" 
      /> 

     <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="32dip" 
     android:background="@drawable/my_background" 
     android:padding="6dip" 
     android:clickable="true" 
     android:onClick="spinnerBarReplacementClicked" 
     > 
     <ImageView 
      android:id="@+id/replacementSelectImg" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true"  
      android:src="@drawable/my_drawable" 
      />  

     <TextView 
     android:id="@+id/replacementSelectText"   
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="4dip" 
     android:layout_toLeftOf="@id/replacementSelectImg" 
     android:textColor="#000000" 
     android:textSize="14sp" 
     android:ellipsize="marquee" 
     android:singleLine="true" 
     /> 

     </RelativeLayout>  
    </FrameLayout> 

,並通過從佈局的點擊到真正的微調

private Spinner mSpinner; 

    mSpinner = (Spinner) findViewById(R.id.theSpinner); 

    public void spinnerBarReplacementClicked(View pV){ 
     mSpinner.performClick(); 
}