Hi All,
I need to load several ImageViews into a layout. The ImageViews are used to show a rating using 'star' icons. The number of stars (i.e. the rating is determined during loading by reading a configuration file.
The ImageViews are sitting inside a RelativeLayout layout.
Currently I am using something like this:
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);
}
My quesions are:
1) Is doing the loading dynamically (not using an xml) is the 'right' way of doing this ?
2) If it is, how do I make the stars display in a line, currently they get placed one on top of the other.
Any help would be appreciated.
RM