PTT
Submit
Submit
选择语言
正體中文
简体中文
PTT
AndroidDev
[问题] array要怎么显示出来啊?
楼主:
ben1357956
(QQ鸡腿)
2017-12-20 21:20:10
各位前辈大家好
小弟我是刚入门的新手
用的是Android Studio
最近学到array跟arrayList
但在创建好一串array值之后(0~5)
却找不到显示的方法
arrayList倒是可以
LinearLayout rootView = findViewById(R.id.ArrayListView);
int index = 0;
while (index < 6) {
TextView childView = new TextView(this);
childView.setText(words.get(index));
rootView.addView(childView);
index++;
}
但是用一样的方法array却让程式直接崩溃
请问要怎么样才能让array用TextView的样子显示出来勒
作者:
evo1994
(Evo)
2017-12-20 23:44:00
for(int i=0;i>array.legth();i++{textview.append(array[i]); }
作者: rin841005 (Rinex)
2017-12-21 09:31:00
TextView的setText可以传String和int,int通常是字串资源档的Id,所以你丢0~5他找不到对应的资源档所以崩溃,这我也常犯错,我都是0+""解决它
作者:
peterwu4
(notd)
2017-12-21 17:12:00
你应该是物件拉错了,ListVew Container要换成LLayout
作者:
aids61517
(奇欧巴肯)
2017-12-21 19:20:00
错误讯息?
继续阅读
[问题] Android Studio首页超出范围?
dharma
Re: [问题] copy .db进 app没成功
MOONY135
[问题] Android 打包 aar 问题
blueblueChen
[问题] copy .db进 app没成功
MOONY135
[问题] 请问apk档可以安装在OPPO手机上吗?
quarry
[闲聊] 大家对fragment的看法
tbpfs
[问题] Android plugin for Unity
gn00618777
[问题] okhttp在中华电信4G get post都会timeout
gnew
[问题] 强制转Fragment的getActivity()
taco2548
[问题] spinner监听问题
jerryxin
Links
booklink
Contact Us: admin [ a t ] ucptt.com