最初に向きを設定した後、向きを設定する方法を教えてください。
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がリストの各行にあることです。ありがとう