<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:andro
>
</Button>

 

在java中写

 

Spinner sp =(Spinner)findViewById(R.id.sp);

//设置资源列表项
ArrayAdapter<CharSequence> adapter =
ArrayAdapter.createFromResource(this, R.array.citys,
android.R.layout.simple_spinner_dropdown_item);
//设置下拉列表项
sp.setAdapter(adapter);

Spinner sp1 =(Spinner)findViewById(R.id.sp1);
List<CharSequence> lists =new ArrayList<CharSequence>();
lists.add("湖南");
lists.add("上海");
lists.add("湖北");
ArrayAdapter<CharSequence> adapte =
new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item,lists);

sp1.setAdapter(adapte);

 

相关文章:

  • 2022-12-23
  • 2021-09-20
  • 2021-07-06
  • 2021-05-29
  • 2021-11-27
猜你喜欢
  • 2021-08-13
  • 2022-12-23
  • 2021-06-28
  • 2021-08-02
  • 2022-01-10
  • 2021-08-20
相关资源
相似解决方案