2017-07-16 2 views
1

Ich habe eine Klasse Include_toolbar für die Einstellung meiner Symbolleiste. Meine Symbolleiste wird in Ordnung gesetzt, aber wenn ich die Symbolleiste nach oben drücke, bewegt sie sich nach oben und verschwindet von meiner RecyclerView.Symbolleiste nicht in meinem Layout behoben - Xamarin.Droid

Was könnte das in meinem Layout bitte verursachen?

Include_toolbar

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    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="@dimen/notification_large_icon_height" 
      android:background="#B22222" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:layout_scrollFlags="scroll|enterAlways"> 
      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/counter_text" 
        android:textSize="20dp" 
        android:textColor="@android:color/white" 
        android:textStyle="bold" /> 
      </RelativeLayout> 
     </android.support.v7.widget.Toolbar> 
    </android.support.design.widget.AppBarLayout> 
    <android.support.v4.view.ViewPager 
     android: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.CoordinatorLayout> 

Activity.axml

<?xml version="1.0" encoding="utf-8"?> 
<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="fill_parent" 
    android:layout_height="fill_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <include 
      layout="@layout/Include_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/notification_large_icon_height" /> 
     <FrameLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/content_frame" /> 
    </LinearLayout> 
    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/content_frame" /> 
    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_height="match_parent" 
     android:layout_width="230dp" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header" 
     app:menu="@menu/drawer_view" /> 
</android.support.v4.widget.DrawerLayout> 
+1

Remove Attribut 'App: layout_scrollFlags = "scroll | enterAlways"' 'von Toolbar' und versuchen Sie es erneut. – FAT

+1

Danke .. das hat funktioniert! –

Antwort

0

Attribut löschen app:layout_scrollFlags="scroll|enterAlways" von Toolbar.

Versuchen Sie folgendes:

<android.support.v7.widget.Toolbar 
     android:id="@+id/toolBar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/notification_large_icon_height" 
     android:background="#B22222" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/counter_text" 
       android:textSize="20dp" 
       android:textColor="@android:color/white" 
       android:textStyle="bold" /> 
     </RelativeLayout> 
    </android.support.v7.widget.Toolbar> 
Verwandte Themen