基于android系统中的动态数据动态布局 [英] dynamic layout based on dynamic data in android

查看:148
本文介绍了基于android系统中的动态数据动态布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从服务器获取一些JSON数据,然后创建元素,以显示数据。由于该数据是为对象的数组,我需要把这个code为一个循环。

i need to get some json data from a server and then create elements to show that data. due the data is into an array of objects, i need to put this code into a loop.

例如:

名字 - 地址

名字 - 地址

名字 - 地址

我在想创造linearlayouts数组里面所需要的部件,并重复这一过程n次。

i am thinking to create an array of linearlayouts with the needed widgets inside and repeat this process n times.

我要去吗?这将是巨大的,如果你能帮助我的一个观点。

am i going right? it would be great if you can help me with a point of view.

亲切的问候和感谢提前。

kind regards and thanks for advance.

推荐答案

不,你应该使用的的ListView 并把你的数据在的 ArrayAdapter 。有很多例子和教程为。

no, you should use a ListView and put your data in an ArrayAdapter. There are lots of examples and tutorials for that.

这篇关于基于android系统中的动态数据动态布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆