Android Studio 的 Spinner 設置方式與eclipse不太一樣

<參考>



1. 在strings.xml 新增(建議用手打字):

< string name = " choose_chocolate " > Choose Chocolate

< string-array name = " chocolate " >

< item > Crackles  < /item >

< item > Fruit and Nut  < /item >

< item > Dairy milk silk < /item >


</string-array>





2. 在layout 檔裡新增:

< Spinner

android:id = " @+id/chocolate_spinner "

android:layout_height = " wrap_content "

android:layout_width = " fill_parent "

android:entries = " @array/chocolate "

android:prompt = " @string/choose_chocolate "

android:layout_toRightOf = " @+id/txtChoco "

android:layout_marginLeft = " 10dp "

android:layout_marginTop = " 15dp " />


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 bravohsiao 的頭像
    bravohsiao

    夏夜醍醐

    bravohsiao 發表在 痞客邦 留言(0) 人氣()