Ich habe versucht, eine scrollbare Ansicht mit einer ViewPager
machen, die 90% des Bildschirms und dann einige nützliche Informationen über Bilder innerhalb der ViewPager
nehmen wird.Scrollview enthält Viewpager und ein Linearlayout
Allerdings, wenn ich das Widget ScrollView
hinzufügen, funktionieren alle Größen und Gewicht nicht, auch wenn ich android:fillViewport="true"
einstellen. Hier ist mein Layout. Entfernen
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="100"
android:scrollbars="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/background_light"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:popupTheme="?android:attr/homeAsUpIndicator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="90"
android:orientation="vertical"
android:padding="50dip">
<android.support.v4.view.ViewPager
android:id="@+id/product_sheet_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<TextView
android:id="@+id/product_sheet_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="bbb"/>
<TextView
android:id="@+id/product_sheet_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Color: Yellow" />
<TextView
android:id="@+id/product_sheet_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ref: 2049/889/300" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Bitte meine Antwort überprüfen und lassen Sie mich wissen, ob es funktioniert. Vielen Dank! –
Machen Sie NestedScrollView match_parent und fügen Sie eine Eigenschaft fitSystemWindows = true zu Ihrem NestedScrollView –
@MuhibPirani Es wirft einen Fehler: (2) Keine Ressource Kennung für Attribut 'fitSystemWindows' im Paket 'android' gefunden, auch wenn ich "compile 'com.android hinzufügen. Unterstützung: Design: 25.3.1 '"innen Gradle Skript –