【问题标题】:Android Toolbar scroll behaviorAndroid 工具栏滚动行为
【发布时间】:2016-08-03 10:21:15
【问题描述】:

我希望工具栏具有scroll|enter_always 的行为。但是,当我滚动时,工具栏的底部显示在我的透明状态栏下,并卡在那里。

你认为我的布局有什么问题?

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:layoutDirection="rtl"
       app:layout_behavior="@string/appbar_scrolling_view_behavior"
       android:fitsSystemWindows="true">
  <android.support.design.widget.AppBarLayout
      android:id="@+id/app_bar_layout"
      app:layout_scrollFlags="scroll|enterAlways"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">
    <android.support.v7.widget.Toolbar
        android:id="@+id/halachotToolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:layout_scrollFlags="scroll|enterAlways"
        app:titleTextColor="@color/White"
        android:layoutDirection="rtl" />
  </android.support.design.widget.AppBarLayout>
  <android.support.v4.widget.NestedScrollView
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">
    <android.support.v7.widget.RecyclerView
      android:id="@+id/halachotRecyclerView"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layoutDirection="rtl"
      android:layout_gravity="center_horizontal"
      android:scrollbars="vertical"
      android:clickable="true" />
  </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

【问题讨论】:

  • 你想如何实现?从 CoordinateLayout 中删除 app:layout_behavior="@string/appbar_scrolling_view_behavior"
  • 尝试从您的CoordinatorLayout 中删除android:fitsSystemWindows="true" 部分。据我所知,这会将其内容插入状态栏高度,导致Toolbar 相信它已经完全消失了。

标签: java android android-layout xamarin xamarin.android


【解决方案1】:

尝试为工具栏设置 android:elevation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多