android - Programmatically create a list of TextViews and ImageViews -
i have parent relativelayout in xml id relative_layout_bottom
in want create list of textviews aligned left of parent , list of imageviews aligned right of parent programmatically. have map of , want iterate on creating layouts. can't seem figure out how work.
this how imagine it:
relativelayout relativelayout = findviewbyid(r.id.relative_layout_bottom) each <textview, imageview> in map { create textview add left of relativelayout create imageview add right of relativelayout }
edit: better have 2 vertical linearlayouts?
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <linearlayout android:id="@+id/linlayleft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:orientation="vertical"> </linearlayout> <linearlayout android:id="@+id/linlayright" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:orientation="vertical"> </linearlayout> </relativelayout>
now can add views linearlayouts programmatically.
Comments
Post a Comment