我想在我的應用程序中使用WearableActionDrawer。以前我是用「com.google.android.support:wearable:2.0.0-alpha1」和我的佈局是這樣的:WearableActionDrawer偷看視圖不隱藏
<?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'的行爲改變了。行動抽屜過去不被看到,直到我滑過來揭示行動菜單,但現在有一個抽屜視圖,除非我打開菜單並選擇一些東西,否則它不會消失。這是預期的行爲嗎?它佔用了大量的房地產:
任何建議,將不勝感激。
選中此[博客](https://www.linkedin.com/pulse/sneak-peek-latest-android-耐磨特性,而開發 - 阿比 - 瓊斯)關於可穿戴式抽屜增強。它表示它顯示了'WearableActionDrawer'的peek視圖中的第一個動作。對於可穿戴抽屜中的其他定製,已將「peek_view」和「drawer_content」屬性添加到「WearableDrawerView」中。導航抽屜的內容可以通過調用notifyDataSetChanged來更新。您也可以查看此[相關主題](https://www.reddit.com/r/AndroidPreviews/comments/4hcfin/how_to_disable_peekheads_up_notifications_on/)。 – abielita
@abielita我看過兩個鏈接,但似乎沒有回答我的問題。從[android文檔](https://developer.android.com/training/wearables/ui/ui-nav-actions.html): _默認情況下,操作抽屜會在用戶到達頂部 或主要滾動內容的底部(即, 實現NestedScrollingChild的視圖)._ 我認爲問題可能是NestedScrollingChild中的內容匹配父級,所以也許android認爲它已經達到了滾動視圖的頂部/底部?有什麼方法可以改變這種行爲來默認隱藏窺視視圖嗎? – grantka
你可能在你的代碼中調用peekDrawer? – AfzalivE