Ich möchte eine "fixed_space" am oberen Rand des Bildschirms und eine "scrollview" am unteren Rand des Bildschirms, die unterhalb von fixed_space sein sollte. Der Rest des Bildschirms ist ein Container "rest_space".Android Scrollview Content-Größe kleiner als sollte
Leider hat meine scrollview eine kürzere Höhe (um 100dp was fixed_space hat), wenn der Inhalt zu groß/scrollbar ist.
Ich versuchte, das gleiche mit ConstraintLayout und RelativeLayout zu erreichen, aber ich habe das gleiche Ergebnis. Irgendwelche Ideen warum scrollview hat 100dp kürzere Höhe, wie es sein sollte?
EDIT: Scrollview sollte so viel Platz nehmen, wie sie benötigt.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:id="@+id/fixed_space"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@android:color/holo_red_dark" />
<View
android:id="@+id/rest_space"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@android:color/black" />
<ScrollView
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_green_dark"
android:fillViewport="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="START OF SCROLLVIEW \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nMIDDLE OF SCROLLVIEW \n\n\n\n\n\n\n\n\n\n\n\nEND OF SCROLLVIEW" />
</ScrollView>
</LinearLayout>
Haben Sie versucht, die "rest_space" Ansicht zu entfernen, dass das Problem Sag mir Verhältnis sein sollte –
von fixed_space, rest_space und Scroll Sie wollen?. –
@PierGiorgioMisley ScrollView sollte nur so viel Platz einnehmen, wie sie benötigt. Wenn ich rest_space lösche, nimmt scrollview den gesamten Abstand zwischen fixed_space und bottom screen. – prosto