: 'Single Action'のhttps://www.google.com/design/spec-wear/components/action-drawer.html#action-drawer-usage 、ActionDrawerは展開できません。 私の質問は、その行動を達成する方法ですか?
私はWearableActionDrawer
とWearableDrawerView
を試しました。 また、lockDrawerClosed()
というメソッドを試しましたが、引き出しが引き続きクリックで開きます。 ご協力いただきありがとうございます! :)1つのアクションでActionDrawerを作成する方法Googleガイドラインで指摘されている
編集:
[OK]をクリックすると、引き出しが開かないようにするソリューションが見つかりました。私は現在WearableActionDrawer
を使用しており、lockDrawerClosed()
を呼び出しています。しかし、今私はpeek_viewを正しく変更する方法がわかりません。
ImageViewを含むカスタムビューLinearLayoutを作成しました。私はこのビューをmWearableActiondrawer.setPeekView(myView)
に使用しています。しかし、問題は、ビューが適切に表示されないことです。一番下に空のActionDrawerが表示されます。 しかしclicklistenerが働いてます。..ここ
は私のコードです:
// Bottom Action Drawer
mWearableActionDrawer = (WearableActionDrawer) findViewById(R.id.bottom_action_drawer);
mWearableActionDrawer.lockDrawerClosed();
LayoutInflater layoutInflater =
(LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
LinearLayout view =
(LinearLayout) layoutInflater.inflate(R.layout.action_drawer_peek_view, null);
mWearableActionDrawer.setPeekContent(view);
view.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_SHORT).show();
}
});
レイアウト:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_drawer_peek_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/wearable_primary"
android:orientation="vertical"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:src="@drawable/fill_1_copy"
/>
</LinearLayout>
私はここで間違ってやっているの任意の考え?ありがとう!