【发布时间】:2014-12-02 21:44:57
【问题描述】:
我创建了一个表格,其中包含有关某些单独标题的信息。但是,我想知道如何将静态图像输入到列中的各个单元格中。
用于创建包含每个单元格中的图像的特定列的代码:
TextView label_col_1_datatab3 = new TextView(this);
label_col_1_datatab3.setId(200+cnt);
label_col_1_datatab3.addTouchables(chair_list +count); //THERE IS AN ERROR FOR THIS LINE WHERE I AM TRYING TO INPUT AN ARRAY OF IMAGES.
label_col_1_datatab3.setText(product_showcase_list[cnt]);
label_col_1_datatab3.setTextColor(Color.BLACK);
label_col_1_datatab3.setPadding(100, 50, 100, 50);
row_tab3.addView(label_col_1_datatab3);
chair_list 代码:
ArrayList<View> chair_list = new ArrayList {
R.drawable.banana_chair,
R.drawable.circular_chair,
R.drawable.purplechair
};
XML:
<TableRow
android:id="@+id/table_Row1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView
android:id="@+id/list_image"
android:layout_width="80dip"
android:layout_height="80dip"
android:src="@drawable/banana_chair"/>
<ListView
android:id="@+id/list_image2"
android:layout_width="80dip"
android:layout_height="80dip"
android:src="@drawable/circular_chair"/>
<ListView
android:id="@+id/list_image3"
android:layout_width="80dip"
android:layout_height="80dip"
android:src="@drawable/purplechair"/>
</TableRow>
【问题讨论】:
-
在您的 XML 文本视图中尝试 drawableright 或 drawabletop 或 drawableleft 或 drawableleft ??
-
@Dhina 你是什么意思?我已经更新了 XML 代码
标签: android listview android-listview arraylist