Ich habe ein seltsames Problem mit dem CoordinatorLayout
und der NestedScrollView
(mit dem Design Support-Bibliothek 22.2.0)NestedScrollView und CoordinatorLayout. Ausgabe auf Scrolling
Mit einem Gehalt kleiner als NestedScrollView
ich sollte einen festen Inhalt haben. Allerdings versuchen, den Inhalt nach oben und unten zu scrollen, kann ich erhalten, dass der Inhalt verschoben wird und nie wieder an ihrem eigenen Ort.
Hier ein kleines Beispiel:
Hier den Code:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:paddingTop="24dp"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/padding">
</FrameLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:visibility="gone"
android:src="@drawable/ic_done" />
</android.support.design.widget.CoordinatorLayout>
Hier ist beste Lösung überprüfen Sie es .. http://StackOverflow.com/A/34947835/4395114 –