FragmentTabHost with horizontal scroll

Based on my experience, the FragmentTabHost doesn’t care much about the xml definitions, things must be made programmatically. I got it working by leaving out the HorizontalScrollView from the xml and adding it in my onCreate for the FragmentActivity. The xml: <android.support.v4.app.FragmentTabHost xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:id=”@android:id/tabhost” android:layout_width=”match_parent” android:layout_height=”match_parent” > <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <TabWidget android:id=”@android:id/tabs” … Read more

How to implement HorizontalScrollView like Gallery?

Try this code: activity_main.xml <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”fill_parent” android:layout_height=”100dip” tools:context=”.MainActivity” > <HorizontalScrollView android:id=”@+id/hsv” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_alignParentTop=”true” android:fillViewport=”true” android:measureAllChildren=”false” android:scrollbars=”none” > <LinearLayout android:id=”@+id/innerLay” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:gravity=”center_vertical” android:orientation=”horizontal” > <LinearLayout android:id=”@+id/asthma_action_plan” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:gravity=”center” android:orientation=”vertical” > <RelativeLayout android:layout_width=”fill_parent” android:layout_height=”match_parent” > <ImageView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”https://stackoverflow.com/questions/18656949/@drawable/action_plan” /> <TextView android:layout_width=”0.2dp” android:layout_height=”fill_parent” android:layout_alignParentRight=”true” android:background=”@drawable/ln” /> </RelativeLayout> </LinearLayout> <LinearLayout android:id=”@+id/controlled_medication” android:layout_width=”wrap_content” android:layout_height=”wrap_content” … Read more