android combobox控件,Android中的组合框
在android組合框中稱為微調框.然而,gnugu已經在自己的博客中發布了自己的一個組合框的實現.
http://www.gnugu.com/node/57
以下是旋轉器的一個簡單示例.
首先,用這樣的方式編輯你的XML代碼
Spinner android:id="@+id/Spinner01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
您的java代碼應該包括這樣的東西,這些選項非常直觀.如果你正在使用eclipse,它會建議你一些選擇
public class SpinnerExample extends Activity {
private String array_spinner[];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Here come all the options that you wish to show depending on the
// size of the array.
array_spinner=new String[5];
array_spinner[0]="option 1";
array_spinner[1]="option 2";
array_spinner[2]="option 3";
array_spinner[3]="option 4";
array_spinner[4]="option 5";
Spinner s = (Spinner) findViewById(R.id.Spinner01);
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, array_spinner);
s.setAdapter(adapter);
}
}
總結
以上是生活随笔為你收集整理的android combobox控件,Android中的组合框的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HTML怎么让正方形转动,第十讲:htm
- 下一篇: 关于鸿蒙工艺调查分析报告,800万芯片订