Ich benutze die neue Android Design-Bibliothek & Auto ausblenden von Toolbar
Funktion. Derzeit funktioniert die automatische Verdeckung beim Scrollen einwandfrei. Aber die dieses Problem haben, werfen Sie einen Blick auf Abbildung unten AppBarLayout komisch nehmen Raum und schieben Inhalt nach unten
Wie Sie sehen die FloatingActionButton
ist geschoben wenig nach unten.
Code:
<android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@android:id/home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:src="@drawable/ic_shuffle"
style="@style/FabStyle"/>
<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"
app:layout_scrollFlags="scroll|enterAlways"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
FabSyle:
<style name="FabStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">bottom|end</item>
<item name="android:layout_marginEnd">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginBottom">@dimen/activity_vertical_margin</item>
<item name="borderWidth">0dp</item>
<item name="elevation">@dimen/fabElevation</item>
<item name="pressedTranslationZ">@dimen/fabPressedZ</item>
</style>
ich auch zu haben versucht margin
& padding
Boden hinzufügen, die funktioniert, aber wenn die Liste gescrollt wird es geht auch auf.
Beste Sache ist, wenn ich mit AppBarLayout
spiele, die die automatische Verdeckung auf Rolle für Toolbar
dann stoppt, sieht FloatingActionButton
gut aus.
Bitte zeigen uns auch die 'FabStyle' wie es derjenige ist, der tatsächlich die Layout alle Parameter des Schwimmaktionstaste hat. – LukaCiko
@LukaCiko Sicher aber es gibt kein Problem mit 'FabStyle'. Ich habe 'AppBarLayout' als Fehlerquelle identifiziert –
@LukaCiko Hast du das Problem? –