【发布时间】:2016-07-18 14:31:39
【问题描述】:
在我的应用程序中,contet 隐藏在 appbarlayout 下。我没想到会有这种行为!
Android 23 预览版
ANDROID 21 - 在设备上测试
ANDROID 21 - 测试隐藏在工具栏下的 DEVICE 内容
尽管我的内容按预期向下滚动,但当它向上滚动时,内容隐藏在工具栏下。我还上传了 android 23 预览,因为可以看到实际上工具栏在状态栏后面对齐顶部。如果预览正确,则处理设备内容会上升到应该移动的位置。但工具栏视图位于状态栏下方而不是后面。我不知道问题出在哪里。
风格
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
</style>
<style name="AppTheme.NoStatusBar" parent="AppTheme.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
更新
好的,我找到了解决方案。太垃圾了。只是我的 scrollView 向下滚动,因为它的最后一个孩子正在获得焦点 - 回收器视图。 不,我在 cardView focusableInTouchMode="true" 和最后一个元素上设置了 false
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fitsSystemWindows="true"
android:fillViewport="true">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
android:layout_margin="4dp"
app:contentPaddingTop="24dp"
android:focusableInTouchMode="true"/>
...
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_overbid_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="200dp"
android:focusable="false"
android:focusableInTouchMode="false"/>
android.support.v4.widget.NestedScrollView>
【问题讨论】:
标签: android android-appbarlayout android-collapsingtoolbarlayout