色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Android studio listview實(shí)現(xiàn)列表數(shù)據(jù)顯示 數(shù)據(jù)循環(huán)顯示效果

瀏覽:35日期:2022-09-24 17:07:35

Android studio listview實(shí)現(xiàn)列表數(shù)據(jù)顯示

Android studio listview實(shí)現(xiàn)列表數(shù)據(jù)顯示 數(shù)據(jù)循環(huán)顯示效果

樣式不好看!想要好看的樣式可以私我,我加!item.xml

<?xml version='1.0' encoding='utf-8'?><!--item --><LinearLayout xmlns:android='http://schemas.android.com/apk/res/android' android:orientation='horizontal' android:layout_width='fill_parent' android:layout_height='fill_parent'> <!--姓名 --> <TextView android:layout_width='130dp' android:layout_height='wrap_content' android: /> <!-- 性別--> <TextView android:layout_width='150dp' android:layout_height='wrap_content' android: /></LinearLayout>

main.xml

<?xml version='1.0' encoding='utf-8'?><LinearLayout xmlns:android='http://schemas.android.com/apk/res/android' android:orientation='vertical' android:layout_width='fill_parent' android:layout_height='fill_parent' > <!-- 標(biāo)題 --> <LinearLayout android:orientation='horizontal' android:layout_width='fill_parent' android:layout_height='wrap_content'> <TextView android:layout_width='130dp' android:layout_height='wrap_content' android:text='姓名' /> <TextView android:layout_width='150dp' android:layout_height='wrap_content' android:text='姓名' /> </LinearLayout> <!-- ListView控件 --><ListView android:layout_width='fill_parent' android:layout_height='fill_parent' android: /></LinearLayout>

MainActivity .java

public class MainActivity extends Activity {List<String> list;List<String> list1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView listView = (ListView) this.findViewById(R.id.listView);//獲取到集合數(shù)據(jù) //名字列表,之后可以動(dòng)態(tài)加入數(shù)據(jù)即可,這里只是數(shù)據(jù)例子 list = new ArrayList<>(); list.add('小明'); list.add('李華'); list.add('張三');list1 = new ArrayList<>(); list1.add('男'); list1.add('男'); list1.add('女');List<HashMap<String, Object>> data = new ArrayList<HashMap<String,Object>>(); for(int i = 0; i < list .size(); i++){ HashMap<String, Object> item = new HashMap<String, Object>(); item.put('name', list.get(i)); item.put('sex', list1.get(i)); data.add(item); } //創(chuàng)建SimpleAdapter適配器將數(shù)據(jù)綁定到item顯示控件上 SimpleAdapter adapter = new SimpleAdapter(MainActivity.this, data, R.layout.item, new String[]{'name', 'sex'}, new int[]{R.id.name, R.id.sex}); //實(shí)現(xiàn)列表的顯示 listView.setAdapter(adapter); }}

總結(jié)

到此這篇關(guān)于Android studio listview實(shí)現(xiàn)列表數(shù)據(jù)顯示 數(shù)據(jù)循環(huán)顯示效果的文章就介紹到這了,更多相關(guān)Android studio listview數(shù)據(jù)顯示 內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Android
相關(guān)文章:
主站蜘蛛池模板: 91久久夜色精品国产网站 | 欧美日韩在线观看一区 | 国产日韩精品一区在线不卡 | 欧美一级在线全免费 | 亚色网址| 国产一区二区三区四区五区tv | 日本欧美一区二区三区视频 | 欧美精品一区二区三区免费观看 | 大焦伊人| 香港三级88久久经典 | 欧美成人h版在线观看 | 在线国产二区 | 91久久国产精品 | 毛片一级做a爰片性色 | 91国语精品自产拍在线观看一 | 美女福利视频午夜在线 | 亚洲第一成人天堂第一 | 日本加勒比视频 | 美女啪啪网站又黄又免费 | 美国一级毛片免费 | 国产成人久久精品区一区二区 | 国产在线观看网址你懂得 | 国产精品亚洲精品日韩已满 | 免费逼片 | 亚洲国产精品自产拍在线播放 | 黑人巨大videos极度另类 | 美女张开腿让人桶 | 日韩一区二区三区在线播放 | 国产黄色a三级三级三级 | 91精品一区国产高清在线 | 99福利网| 一区二区影院 | 中文字幕国产视频 | 国产精品一一在线观看 | 国产乱子伦在线观看不卡 | aaaaaaa一级毛片 | 美国一级毛片片aaa 美国一级毛片片aa成人 | 在线国产一区二区三区 | 国产欧美另类久久久精品免费 | 日本在线免费视频 | 91久久精品国产亚洲 |