android-menu

How to set a long click listener on a MenuItem (on a NavigationView)?

守給你的承諾、 提交于 2019-12-28 20:36:14
问题 How can I set a long click listener on a MenuItem ? I tried this answer, but the method doesn't exist for me. Any solutions? Code: Menu menu = navigationView.getMenu(); MenuItem menuItem = menu.findItem(R.id.menu_item); // TODO set a long click listener on the menuItem. menuItem.setOnLongClickListener(...); // Method does not exist, any other solutions? Edit: I don't want to set a custom ActionView, I want the long click listener to the whole MenuItem , without a custom View. 回答1: one of many

How to set a long click listener on a MenuItem (on a NavigationView)?

耗尽温柔 提交于 2019-12-28 20:35:51
问题 How can I set a long click listener on a MenuItem ? I tried this answer, but the method doesn't exist for me. Any solutions? Code: Menu menu = navigationView.getMenu(); MenuItem menuItem = menu.findItem(R.id.menu_item); // TODO set a long click listener on the menuItem. menuItem.setOnLongClickListener(...); // Method does not exist, any other solutions? Edit: I don't want to set a custom ActionView, I want the long click listener to the whole MenuItem , without a custom View. 回答1: one of many

How to make overflow menu like Chrome app?

谁说我不能喝 提交于 2019-12-28 06:35:22
问题 I would like to make an overflow menu similar to the chrome app in android in which it has the forward, backward and bookmark button inside it. This is the overflow menu in the chrome app. Any ideas? Please i need help. Thanks in advance. 回答1: You can't have custom views for your overflow menu items, so Chrome is not using the standard action bar. It's weird that Google doesn't even use its own standard tools that it pushes for everyone else to use, but that's just how it goes. If you load up

How to display and set click event on Back Arrow on Toolbar?

和自甴很熟 提交于 2019-12-28 03:46:12
问题 How can I set back arrow in Android toolbar and also apply click listener? 回答1: First make one toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/colorPrimary" local:theme="@style

How to display and set click event on Back Arrow on Toolbar?

时光总嘲笑我的痴心妄想 提交于 2019-12-28 03:46:07
问题 How can I set back arrow in Android toolbar and also apply click listener? 回答1: First make one toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/colorPrimary" local:theme="@style

Android Checkable Menu Item

二次信任 提交于 2019-12-28 03:32:05
问题 I have the following menu layout in my Android app: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/item1" android:titleCondensed="Options" android:title="Highlight Options" android:icon="@android:drawable/ic_menu_preferences" /> <item android:id="@+id/item2" android:titleCondensed="Persist" android:title="Persist" android:icon="@android:drawable/ic_menu_preferences" android:checkable="true" /> </menu> My problem

How to detect soft menu key available in android device?

吃可爱长大的小学妹 提交于 2019-12-25 17:43:04
问题 I would like to check menu key presence in the device in android application. To achieve that i used following code to detect weather device is having hardware menu or not and it is working fine !ViewConfiguration.get(ScsCommander.getInstance().getApplicationContext()).hasPermanentMenuKey() But i did not find a logic to find weather the device is having soft menu present or not. Please suggest me is there any way to detect soft menu is available or not in the device. 回答1: There is no reliable

Android - Can't see the menu option at a fragment layout

让人想犯罪 __ 提交于 2019-12-25 12:55:07
问题 I've bumped into something I don't understand. I'm using the next layout XML code - <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <WebView android:id="@+id/faq_webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> As you can see it only contains a WebView. Now I've created a

How can I override my menu bar to come on my application bar?

痞子三分冷 提交于 2019-12-25 08:09:03
问题 I have recycler view + viewpager + toolbar in my activity. When I long click on the row in recycler view it should show me a menu bar with a delete option. But this is what I get. Any ideas as to why it is coming above my application name? This is the xml of my main activity: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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

Override menu key long press and launch an application on long press

时光怂恿深爱的人放手 提交于 2019-12-25 04:59:13
问题 I want to do something like this- 1.Override the default action of the menu key long press (i.e. launching soft keyboard). 2.Whenever user long presses the menu key, my application will be launched. 3.Moreover, my application may not need to be in the foreground, i.e. even if someone long presses menu key from any other application my application should be launched. Is this at all possible? How? 回答1: Is this at all possible? How? By making your own firmware, where you add this capability to