I'm pretty new to android development, and I've been having some problems getting my layout to show the way I want it to. Basically what I want is four side-scrolling views containing an images with labels. The number of images isn't known until run-time. I want the side-scrolling views to be scalable to different sizes.
Right now, the setup I have looks something like this: Main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff" android:id="@+id/build">
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_weight="1"
android:layout_height="0dp" android:background="#ddd" android:id="@+id/ahsv" />
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_weight="1"
android:layout_height="0dp" android:background="#ddd" android:id="@+id/ihsv" />
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_weight="2"
android:layout_height="0dp" android:background="#ddd" android:id="@+id/mhsv" />
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_weight="3"
android:layout_height="0dp" android:background="#ddd" android:id="@+id/rhsv" />
viewitem.xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:background="#fff">
<ImageView android:id="@+id/image" android:layout_height="fill_parent"
android:layout_width="fill_parent" android:scaleType="center" />
<TextView android:id="@+id/title" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textColor="#000"
android:layout_gravity="center_horizontal|bottom" />
There's also a LinearLayout that goes inside of the HorizontalScrollViews
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#fff"
android:id="@+id/horizll"/>
At this point my code just instantiates a bunch of these viewitems using LayoutInflator, adds them to the LinearLayout (horizll), that was inflated and added to the HorizontalScrollView. (all of this is done in onCreate())
The code works almost as intended. I have four side-scrolling lists that have heights corresponding to their weights. However, the images inside of these are stuck at their default size, in other words, they are not scaling with the height of the HorizontalScrollView.
What am I doing wrong?
Thanks in advance for the help