欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

android studio自动提示文本框

程序员文章站 2022-07-14 17:57:27
...


protected void onCreate(Bundle savedInstanceState) {
private String[] data1;
private ArrayAdapter adapter1 ;
private AutoCompleteTextView act_main_act1;

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
 act_main_act1=(AutoCompleteTextView)findViewById(R.id.act_main_cat1);//版本原因,有些需要强转有些不需要
 //获取数据
        data1 = new String[] { "愤怒的小鸟", "汤姆猫", "落汤鸡", "牛牛", "哈巴狗", "神龙", "烤鸭","小象", "美人鱼", "九尾狐" };
//创建适配器
        adapter1 = new ArrayAdapter<String>( this,R.layout.act_main_item1,data1);
//绑定适配器
        mtv_main_mtv1.setAdapter(adapter1);
 }
}
相关标签: 自动提示文本框