android常用控件总结(19)
发布时间:2021-06-06
发布时间:2021-06-06
android 常用控件总结
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
/>
</LinearLayout>
public class Activity01 extends Activity{
private static final String[] string = { "O型", "A型", "B型", "AB型", "其他" };
private TextView m_TextView;
private Spinner m_Spinner;
private ArrayAdapter<String> adapter;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(yout.main);
m_TextView = (TextView) findViewById(R.id.TextView1);
m_Spinner = (Spinner) findViewById(R.id.Spinner1);
//将可选内容与ArrayAdapter连接
adapter = new ArrayAdapter<String>(this,
yout.simple_spinner_item, string);
//设置下拉列表的风格
adapter.setDropDownViewResource(yout.simple_spinner_dropdown_item);
//将adapter添加到m_Spinner中
m_Spinner.setAdapter(adapter);
上一篇:铺邑小学读书节启动仪式主持词
下一篇:小学体育障碍跑教案