android-menu

Overriding the physical menu button on android

混江龙づ霸主 提交于 2020-03-14 07:42:11
问题 I would like the menu key on my Android device to open a dialog instead of opening the menu while my app is running. I tried to code that into onCreateOptionsMenu(Menu menu) but it worked only for the first time I pressed the menu button. Can I do it in some other way? 回答1: You can override the default behavior of system key presses by intercepting them in your Activity. This is done by overriding the onKeyDown event, and returning true if you want to prevent the key from being handled by the

Getting “Link text” of the link displayed in WebView

送分小仙女□ 提交于 2020-01-25 09:53:07
问题 I have Android WebView which displays some links as: <a href="http://link1.html">Link1Text</a> <a href="http://link2.html">Link2Text</a> Now I would like to retrieve Link1Text and Link2Text when I long press these links. I have contextMenu implemented in the code and I could successfully get the link urls (http://link1.html, http://link2.html) using HitTestResult getExtra() method but how ccan I get those link texts ? FYI, I require those link texts for implementing "Copy link text" option in

Adding android drawable to menu XML stop app compiling

血红的双手。 提交于 2020-01-15 12:08:17
问题 I am working on an android project and have an XML file for the action bar menu, its been working fine, but I now need to add an extra item with an icon, but it this displays an error in the eclipse tab and the console output. If I remove the icon field, then its fine, but if I add the icon, then I get the error. Below is the XML that contains the menu item. I've included one item that previously worked and the new item that isn't working <item android:id="@+id/mnu_search" android:title=

Android creating Bottom Bar Menu

☆樱花仙子☆ 提交于 2020-01-13 20:38:30
问题 I want to have an static bottom menu bar exist through out the applications in every page visible at bottom all the time. I have designed the menu bar but i am confused whether i have to integrate the menu code with every layout xmls to make menu visible in every page and write the code in every activity class to perform functions on menu clicks. Or if there is any other way i can create a common bottom bar that lies with every page with writing the code of menu in a single activity class .

Android creating Bottom Bar Menu

对着背影说爱祢 提交于 2020-01-13 20:38:27
问题 I want to have an static bottom menu bar exist through out the applications in every page visible at bottom all the time. I have designed the menu bar but i am confused whether i have to integrate the menu code with every layout xmls to make menu visible in every page and write the code in every activity class to perform functions on menu clicks. Or if there is any other way i can create a common bottom bar that lies with every page with writing the code of menu in a single activity class .

ExpandableListView / Drill-Down in Sliding Menu

喜你入骨 提交于 2020-01-13 04:13:30
问题 Here is the Current UI for Side Menu. Here is the image of an app with DRILL-DOWN or Expandable ListView Menu how to create same menu UI for the first image? 回答1: Looks like you've posted another similar question, where I've provided several links to tutorials and tips from my work with ExpandableListViews: Sub Menu in App Please let me know if there is any information you are still unclear on. 回答2: I already implementing expandable listview inside navigation drawer. This is full source code

How to override web view text selection menu in android

余生颓废 提交于 2020-01-09 19:45:07
问题 The basic android's web text selection menu is as shown in image attached below. It has options like copy, share, select all, web search. I want to over ride this menus and want them as my own menu list like "mark colour", "mark as imp" etc. I look around most of the questions available about context menu on stack overflow. The most of the question relate with context menu but not giving result as expected. I want menu like below image When I perform selection android monitor shows some view

Action Bar menu item text color

旧街凉风 提交于 2020-01-09 01:56:13
问题 How to change text color of menu item title. I tried to change it as below <style name="Theme.Kanku.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"> <item name="android:textColor">@color/white</item> </style> But it change color only of Action Bar title text, but not menu item text. 回答1: Try something like this : <style name="ThemeName" parent="@style/Theme.Sherlock.Light"> <item name="actionMenuTextColor">@color/white</item> <item name="android

How to change List<String> value inside onOptionsItemSelected in Android Studio?

為{幸葍}努か 提交于 2020-01-07 03:53:09
问题 String[] klassen = {"3ECa1", "3ECa2", "3ECb", "3WEa", "3WEb", "3STWa", "3STWb", "3STWc"}; String[] klassen2 = {"4ECa", "4ECb", "4WE", "4STWa", "4STWb", "4STWc", "1Okan", "2Okan"}; String[] klassen3 = {"5EM", "5EW", "5MW", "5WW", "5STWa", "5STWb", "5STWc", "1Okan"}; String[] klassen4 = {"6EM", "6EW", "6MW", "6WW", "6STWa", "6STWb", "6STWc", "2Okan"}; List<String> klassenList = Arrays.asList(klassen); public boolean onOptionsItemSelected(MenuItem item){ int id = item.getItemId(); switch(id){

Android:Option menu appearance and icon not getting displayed

空扰寡人 提交于 2020-01-05 08:52:33
问题 I am facing a few problems with the android option menu. Here is my code: Inside res folder, i created a menu folder containing menu.xml file with this below code: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:icon="@drawable/green" android:id="@+id/icon" /> <item android:id="@+id/text" android:title="Text"/> <item android:id="@+id/icon1" android:title="Icon and Text" android:icon="@drawable/icon"/> </menu> And this is