我需要将多个ImageView加载到布局。 ImageViews用于显示使用'star'图标的评分。恒星(即等级的数量由读取配置文件加载期间确定将多个ImageView添加到布局
的ImageViews正坐在一个RelativeLayout的布局里面
目前我使用的是这样的:。
RelativeLayout l = ((RelativeLayout)(findViewById(R.id.RelativeLayout01)));
for (int nStarCount = 0; nStarCount < config.getAsInt("stars", 1); nStarCount ++) {
ImageView image = new ImageView(this);
image .setImageResource(R.drawable.star);
image .setAdjustViewBounds(true);
l.addView(i);
}
我的问题是:
1)是做动态加载(不使用XML)是这样做的'正确的方式?
2)如果是这样,我该如何让星星排成一行,目前他们将一个放在另一个的上面。
任何帮助,将不胜感激。
RM
你有什么需要在这篇文章中,? – 2011-08-17 07:47:47