The simplest and easiest way to implement a horizontal list.
Horizonatalscroll.xml
<?xml version="1.0" encoding="utf-8"?> <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fadeScrollbars="false" android:background="@color/list_item_bg_color"> </HorizontalScrollView>
horizontal_list.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/horizontal_outer_layout" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_margin="0dp" android:background="@drawable/rect_border_box" android:orientation="vertical" > <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </Linearlayout>
java code:
LinearLayout parent = (LinearLayout) getLayoutInflater().inflate( R.layout.observation_detail_parent_layout, null); Linearlayout child= null;
source share