WearableActionDrawer peek 视图不隐藏
WearableActionDrawer peek view does not hide
我正在尝试在我的应用程序中使用 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' 后,行为发生了变化。在我向上滑动以显示操作菜单之前,操作抽屉一直不可见,但现在抽屉的窥视视图不会消失,除非我打开菜单和 select 某些东西。这是预期的行为吗?它占用了大量的空间:
如有任何建议,我们将不胜感激。
正如我所怀疑的那样,当 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);
我正在尝试在我的应用程序中使用 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' 后,行为发生了变化。在我向上滑动以显示操作菜单之前,操作抽屉一直不可见,但现在抽屉的窥视视图不会消失,除非我打开菜单和 select 某些东西。这是预期的行为吗?它占用了大量的空间:
如有任何建议,我们将不胜感激。
正如我所怀疑的那样,当 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);