8

Ich möchte, dass die Symbolleiste (Aktionsleiste) beim Scrollen vollständig ausgeblendet wird. Beim Starten der Aktivität oder beim Zurückscrollen sollte die Symbolleiste sichtbar und die Statusleiste hellgrau sein.Die Symbolleiste wird nicht unter der transparenten Statusleiste angezeigt

  1. Start als [Statusleiste | Symbolleiste | Inhalt]
  2. herunterscrollen [co- (statusbar) -entent]
  3. hochscrollen [statusbar | Symbolleiste | Inhalt]

derzeit:

  1. beim Start/boot startup/boot

  2. gescrollt Inhalt Scrolled content down

  3. nach unten gescrollt Inhalt bis Scrolled content up

activity_layout.xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@color/background_white" 
tools:context="com.conevoud.captjeluigi.ui.activities.GalleryActivity"> 

<android.support.design.widget.CoordinatorLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

    <include layout="@layout/toolbar" /> 

</android.support.design.widget.CoordinatorLayout> 

<include layout="@layout/drawer_left" /> 

</android.support.v4.widget.DrawerLayout> 

toolbar.xml

<merge xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/toolbar_frame" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     app:layout_scrollFlags="scroll|enterAlways" 
     app:popupTheme="?popup_theme" 
     app:theme="@style/ThemeOverlay.AppCompat.ActionBar" /> 

</android.support.design.widget.AppBarLayout> 
</merge> 

Stile:

<item name="windowActionModeOverlay">true</item> 

    <item name="android:windowTranslucentNavigation">true</item> 
    <item name="android:windowTranslucentStatus">true</item> 

danke für das Lesen.

+0

Glück gehabt diese Festsetzung loswerden? – SqueezyMo

+1

Ich habe eine Lösung gefunden, die jemand noch wissen will? – ThirdMartian

+0

ja, bitte. @ThirdMartian –

Antwort

0

Ich hatte vorher ein sinusförmiges Problem, versuchen Sie android:fitsSystemWindows=”true” in Ihrem AppBarLayout zu setzen.

<android.support.design.widget.AppBarLayout 
    android:id="@+id/toolbar_frame" 
    android:fitsSystemWindows=”true” 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     app:layout_scrollFlags="scroll|enterAlways" 
     app:popupTheme="?popup_theme" 
     app:theme="@style/ThemeOverlay.AppCompat.ActionBar" /> 

</android.support.design.widget.AppBarLayout> 
0

Ich hatte das ähnliche Problem. Meine war gelöst.

  1. Hinzugefügt android:fitsSystemWindows="true" to the AppBarLayout.
  2. Added app:layout_scrollFlags="scroll|enterAlways|snap" für Toolbar

unten ist das Layout ich hatte.

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".HomeActivity"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:fitsSystemWindows="true" 
    android:theme="@style/AppTheme.AppBarOverlay"> 
     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways|snap" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/id_tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

</android.support.design.widget.AppBarLayout> 

<android.support.v4.view.ViewPager 
    android:id="@+id/id_viewpager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:src="@android:drawable/ic_dialog_email"/> 

0

es sieht aus wie die einzigen Optionen ist - von

<item name="android:statusBarColor">@android:color/transparent</item> 

Eigenschaft