在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);
}
}