我目前有一个二维字符串数组,其中包含来自互联网网站的信息。如何使用这个数组来显示一个表格,TextViews
其中每个 textview 将包含来自数组的文本?
任何帮助将不胜感激。
You would probably want to use a ListView
.
A ListView
can be used to display the data that you have in the array with each row in the list displaying a text from the array.
Have a look at the documentation here.
EDIT : There is another way of doing it, which is closer to your actual idea of a table of TextViews.
You can define a vertical LinearLayout and then run a loop through your array, and for every element in the array dynamically add a TextView to the LinearLayout.
This method is more complex than using the ListView and I would suggest you to go for the ListView if you are not very much acquainted with Android.