2017-07-16 11 views
1

私はクラスを持っています私のツールバーを設定するためのInclude_toolbar。私のツールバーは問題なく設定されていますが、ツールバーを押し上げると、それが上に移動し、私のrecyclerViewから消えます。ツールバーは私のレイアウトに固定されていません - Xamarin.Droid

私のレイアウトでこれを引き起こしている原因は何ですか?

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

削除属性 'アプリ:layout_scrollFlags = | Toolbar''から "スクロールがenterAlways" 'して、やり直してください。 – FAT

+1

ありがとうございました! –

答えて

0

Toolbarから属性app:layout_scrollFlags="scroll|enterAlways"を削除します。

これを試してみてください:

<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> 
関連する問題