2016-03-05 29 views
0

我正在嘗試微調從1http://www.ahotbrew.com/android-dropdown-spinner-example/Android微調器沒有得到慾望的結果

該代碼正在工作,但結果不是我想要的。結果是這樣的:

I got this

但我想微調象下面這樣:

But I want this

不要忘了查看附件。

敏SDK 15,編譯SDK 23

+1

請提供您所寫的相關代碼。 – Michael

+1

由於應用程序材質外觀的原因,您可以獲得該外觀。您應該嘗試遵循材料設計指南。如果你堅持要有自己的外觀,請閱讀https://guides.codepath.com/android/Developing-Custom-Themes –

+1

結果究竟出了什麼問題。難道你不喜歡Caffe Americano而不是Cappucino?它的大小?它是分隔物品的線條嗎?還有別的嗎? – MikeT

回答

0

我的問題是由styles.xml使用自定義主題微調解決:

的main.xml:

<Spinner 
    android:id="@+id/spThemes" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:entries="@array/theme_array" 
    android:spinnerMode="dropdown" 
    style="@style/spinner_style" 
    /> 

Styles.xml:

<style name="spinner_style" > 
    <item name="android:theme">@android:style/Theme.Holo</item> 
    <item name="android:layout_marginLeft">10dp</item> 
    <item name="android:layout_marginRight">10dp</item> 
    <item name="android:layout_marginBottom">10dp</item> 
    <item name="android:paddingLeft">8dp</item> 
    <item name="android:paddingTop">5dp</item> 
    <item name="android:paddingBottom">5dp</item> 

    <!-- Customize your theme here. --> 
</style>