I would like to know how can i set the orientation after setting it in the beginning?
public class IconifiedTextView extends LinearLayout {
private ImageView iconImage;
private TextView titleText;
private TextView mainText;
private ImageView mainImage;
public IconifiedTextView(Context context, IconifiedText iconifiedText) {
super(context);
this.setOrientation(HORIZANTAL);
//
iconImage = new ImageView(context);
iconImage.setImageDrawable(iconifiedText.getIconImage());
// left, top, right, bottom
iconImage.setPadding(0, 2, 5, 0); // 5px to the right
addView(iconImage, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
titleText = new TextView(context);
titleText.setText(iconifiedText.getTitleText());
/* Now the text (after the icon) */
addView(titleText, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
mainText = new TextView(context);
mainText.setText(iconifiedText.getMainText());
/* Now the text (after the icon) */
addView(mainText, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
/*
* At second, add the other Icon to ourself (! we are extending
* LinearLayout)
*/
mainImage = new ImageView(context);
mainImage.setImageDrawable(iconifiedText.getMainImage());
// left, top, right, bottom
mainImage.setPadding(15, 2, 20, 0); // 5px to the right
addView(mainImage, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
my question here, that i want iconImage first then titleText and below it mainText then next to it on the right the mainImage in each row in the list can anyone help?
thanks
You should probably use Relative layout for this task.
Make a relative layout:
I hope it solves your problem.