I have 2 xml file like this:
main.xml:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/ll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
items.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl"
android:layout_width="100dp"
android:layout_height="100dp">
<ImageView
android:id="@+id/img"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:contentDescription="@string/app_name"
android:gravity="center"
android:src="@drawable/icon_shop2" />
<TextView
android:id="@+id/providerName"
style="@style/WhiteTextMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/img"
android:layout_gravity="bottom"
android:paddingLeft="10dp"
android:text="Example" />
</RelativeLayout>
main.xml is used for MainActivity.
My question is how to dynamically load 3 layouts items.xml to Linearlayout in the HorizontalScrollView of main.xml!