我正在尝试在我的应用中使用WearableActionDrawer。以前我使用'com.google.android.support:wearable:2.0.0-alpha1',我的布局如下:
<?xml version="1.0" encoding="utf-8"?>
<android.support.wearable.view.drawer.WearableDrawerLayout
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"
app:rectLayout="@layout/rect_activity_main"
app:roundLayout="@layout/round_activity_main"
tools:context="com.example.grant.wearableclimbtracker.MainActivity"
tools:deviceIds="wear">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id = "@+id/content_frame">
<android.support.wearable.view.GridViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
<android.support.wearable.view.drawer.WearableNavigationDrawer
android:id = "@+id/top_navigation_drawer"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@color/dark_grey"/>
<android.support.wearable.view.drawer.WearableActionDrawer
android:id="@+id/bottom_action_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey" />
</android.support.wearable.view.drawer.WearableDrawerLayout>
切换到'com.google.android.support:wearable:2.0.0'后,行为发生了变化。动作抽屉过去一直不在视野中,直到我向上滑动以显示动作菜单,但现在除非我打开菜单并选择一些内容,否则抽屉的视图不会消失。这是预期的行为吗?它占用了大量的房地产:
非常感谢任何建议。
答案 0 :(得分:1)
正如我所怀疑的那样,当NestedScrollingChild高度与父视图匹配时,动作抽屉会查看。我可以隐藏的唯一方法是将NestedScrollingChild视图增加1dp:
// get the screen width
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
// set height of framelayout to be slightly larger than view
mSessionLayout = rootView.findViewById(R.id.sessionLayout);
mSessionLayout.setMinimumHeight(metrics.heightPixels+1);