Макет моей деятельности должен быть следующим:
- Экран разделен на 3 секции (3 «строки»)
- Первый раздел состоит из изображения слева,и два TextViews рядом с ним.
- второй раздел - это большой текст, помещенный в ScrollView, чтобы его можно было прокручивать.
- третий раздел - просто кнопка, и эта кнопка должна находиться навсегда внизу экрана.
Итак, и 1-я, и 3-я секции должны быть зафиксированы, прокручивать можно только 2-ю секцию.
Вот мой код:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout0"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/imageView1"
android:text="TextView" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/imageView1"
android:layout_below="@id/textView1"
android:text="TextView" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/relativeLayout1">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text BIG BIG text " />
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/relativeLayout2">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</RelativeLayout>
</RelativeLayout>
Проблема здесь довольно очевидна:
Текст в средней части можно хорошо прокручивать, но проблема в том, что ScrollView не«конец», когда кнопка «начинается» в макете.