Я довольно новичок в разработке для Android, и у меня возникли некоторые проблемы с настройкой макета, чтобы показать, как я этого хочу.По сути, мне нужны четыре вида с боковой прокруткой, содержащие изображения с метками.Количество изображений не известно до времени выполнения.Я хочу, чтобы виды с боковой прокруткой можно было масштабировать до разных размеров.
Прямо сейчас у меня выглядит примерно так: 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" />
Существует также LinearLayout, который находится внутри 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"/>
На данный момент мой код просто создает несколько такихэлементы зрения, использующие LayoutInflator, добавляют их к LinearLayout (horizll), который был раздут и добавлен в HorizontalScrollView.(все это делается в onCreate ())
Код работает почти так, как задумано.У меня есть четыре списка боковой прокрутки, высота которых соответствует их весу.Однако изображения внутри них застряли в размере по умолчанию, другими словами, они не масштабируются с высотой HorizontalScrollView.
Что я делаю не так?
Заранее спасибоза помощь