我想知道在开始设置后如何设置方向?
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));
}
我的问题是,我首先想要iconImage,然后是titleText,然后是mainText,然后在右边是列表中每一行的mainImage,有人可以帮忙吗?谢谢