如何让Spinner下拉框实现多选功能
2015-01-03
展开全部
您好,希望以下回答能帮助您
思路:tableLayout tab = new TableLayout(this); 然后设置属性.
mSpinnerAge = new Spinner(context);
mSpinnerAge.setLayoutParams(paramsw);
ageList = super.defaultAgeList;
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, ageList);//ageList是数组
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinnerAge.setAdapter(adapter);
多选框
checkBoxcb = new CheckBox(this);
cb.setChecked(true);
cb.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(
CompoundButton buttonView,
boolean isChecked) {
CheckBox checkBox = (CheckBox) buttonView;
Log.v("Test", String.valueOf(checkBox.getText()) +
" is " + String.valueOf(isChecked));
}
tab.addview(sp);
如您还有疑问可继续追问。
思路:tableLayout tab = new TableLayout(this); 然后设置属性.
mSpinnerAge = new Spinner(context);
mSpinnerAge.setLayoutParams(paramsw);
ageList = super.defaultAgeList;
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, ageList);//ageList是数组
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinnerAge.setAdapter(adapter);
多选框
checkBoxcb = new CheckBox(this);
cb.setChecked(true);
cb.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(
CompoundButton buttonView,
boolean isChecked) {
CheckBox checkBox = (CheckBox) buttonView;
Log.v("Test", String.valueOf(checkBox.getText()) +
" is " + String.valueOf(isChecked));
}
tab.addview(sp);
如您还有疑问可继续追问。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询