options-menu

Custom options menu in Android

南笙酒味 提交于 2019-11-27 15:19:27
I want to create a custom OptionsMenu in my application. The default OptionsMenu display only three items in one row. Now i want to display five to six items having only icons. Also i want to change the background color of the OptionsMenu but not getting the appropriate way of doing this. If it is possible then please let me know about it. Macarse Short answer As an user it bothers me when the application changes my android's widgets. I wouldn't recommend changing that and android doesn't provide a way to do it. Long answer Even though Android doesn't provide a way to customize that you can

SearchView in OptionsMenu not full width

只愿长相守 提交于 2019-11-27 07:25:23
I have a working SearchView which expands in my OptionsMenu when the user taps on the search icon. However it only expands within the available space among the other OptionsMenu icons. On a wide screen this is fine, but with a narrow space there is only room to show 5-10 charaters in the search box. I want it to overlay the other icons such as it does for the Android Contacts app. Currently, I'm building with targetSdkVersion = 17. Hopefully I'm missing something simple :) (Note added later: the only solution I've found workable so far is to hide all the menu icons when I want to expand the

How can I alter a MenuItem on the Options Menu on Android?

大兔子大兔子 提交于 2019-11-27 00:42:13
问题 I have an Options Menu on my Activity with an MenuItem "Start". When this MenuItem is selected I would like to alter the Menu so it contains a MenuItem "Stop". And finally when "Stop" is selected, I would like to alter back to "Start". Here is parts of my code that isn't working. I have both "Start" and "Stop" listed in mymenu.xml I should probably remove "stop" when the menu is created: public class MyActivity extends Activity { private boolean isStarted = false; @Override public boolean

java.lang.illegalstateexception: a factory has already been set on this layoutinflater

流过昼夜 提交于 2019-11-26 23:21:47
问题 I have tried to change the background color of options menu in my android app. I am using ActionBarSherlock library. I have tried this code for changing the background color of options menu https://stackoverflow.com/a/8475357/584095 But I ended up with an exception "java.lang.illegalstateexception: a factory has already been set on this layoutinflater" at line LayoutInflater.setFactory(); I don't know what is wrong in this code. Can anyone help me in resolving this issue? 回答1: There been a

Android options menu icon won't display

烈酒焚心 提交于 2019-11-26 20:46:53
I'm following a book on Android Development to get myself started writing my first real app. I got up to the point where I'm making an options menu for one of my activities. The menu shows up, but the corresponding icon of the menu item refuses to display. Here is the code for the menu: ReminderListActivity @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater mi = getMenuInflater(); mi.inflate(R.menu.list_menu, menu); return true; } res/menu/list_menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com

Custom options menu in Android

ⅰ亾dé卋堺 提交于 2019-11-26 17:07:31
问题 I want to create a custom OptionsMenu in my application. The default OptionsMenu display only three items in one row. Now i want to display five to six items having only icons. Also i want to change the background color of the OptionsMenu but not getting the appropriate way of doing this. If it is possible then please let me know about it. 回答1: Short answer As an user it bothers me when the application changes my android's widgets. I wouldn't recommend changing that and android doesn't

Handling a Menu Item Click Event - Android

落花浮王杯 提交于 2019-11-26 15:10:39
I want to create an intent that starts a new activity once a Menu Item is clicked, but I'm not sure how to do this. I've been reading through the android documentation, but my implementation isn't correct..and some guidance in the right direction would help. I've listed my code below and commented out my problem areas, I think I'm invoking the wrong method. package com.jbsoft.SimpleFlashlight; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.*; import android.view.MenuItem.OnMenuItemClickListener; import android.widget.Button; import

Handling a Menu Item Click Event - Android

孤人 提交于 2019-11-26 04:11:40
问题 I want to create an intent that starts a new activity once a Menu Item is clicked, but I\'m not sure how to do this. I\'ve been reading through the android documentation, but my implementation isn\'t correct..and some guidance in the right direction would help. I\'ve listed my code below and commented out my problem areas, I think I\'m invoking the wrong method. package com.jbsoft.SimpleFlashlight; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import