android - How to add image into TextView -
i have created table contains info on individual headings. however, wondering how input static image individual cells within column.
code used create specific column inclusive of images in each cell:
textview label_col_1_datatab3 = new textview(this); label_col_1_datatab3.setid(200+cnt); label_col_1_datatab3.addtouchables(chair_list +count); //there error line trying input 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);
code 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>
try code snippet below :
textview label_col_1_datatab3 = new textview(this); label_col_1_datatab3 .setcompounddrawableswithintrinsicbounds(r.drawable.icon, 0, 0, 0);
android listview android-listview arraylist
No comments:
Post a Comment