Android使用LinearViewLayout展示数据

image


如果要滚动,使用ScrollView来包裹这个LinearViewLayout。


ListView控件,自己带有滚动效果的。


BaseAdapter


LayoutInflater



其他两种绑定方式


image


ArrayAdapter和SimpleAdapter的演示。




ListView mListView = (ListView) findViewById(R.id.listview);

String[] textArray = { }


/**

* listview子条目的布局

* 要显示的数据

*/

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item1, textArray);


SimpleAdapter(context, List<? extends Map<String, ?>> data,

resource  // 自条目布局的id, from  // data中map集合中的key ,to  // resource中的id)

原文地址:https://www.cnblogs.com/tuhooo/p/7895058.html