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

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值