Android开发中,设置下拉框,与获取下拉框的值数据

android 绑定下拉按钮里面的值
前段代码
string.xml 里面的代码:

1
2
<×ring-array>显示代码k需要设置的熟悉

这是前端展示页面需要写的关键属性代码
android:entries="@array/feature"
后台代码,过去下拉框当前选中的值:
Spinner viewById = findViewById(R.id.spinner1); TextView text1 = findViewById(R.id.textView1); String s = viewById.getSelectedItem().toString(); text1.setText(s);这是将获取到的数据转为string类型

猜你喜欢

转载自blog.csdn.net/qq_49249150/article/details/123836441