水平リストビューを実装するための最も簡単で簡単な方法。
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コード:
LinearLayout parent = (LinearLayout) getLayoutInflater().inflate(
R.layout.observation_detail_parent_layout, null);
Linearlayout child= null;
//iterate views upto you adapater count.
for(int i=0;i<14;i++){
child = (LinearLayout) getLayoutInflater().inflate(
R.layout.horizontal_list, null);
//set your views specified in horizontal_list.xml
TextView text = (TextView) findViewById(R.id.text);
text.setText("your text");
parent.addView(child);
}