android-actionbar

ActionBar MenuItem selector [closed]

浪子不回头ぞ 提交于 2019-12-07 13:32:45
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . Is it possible to change the Image of a MenuItem when pressed and can that be done by a selector (different MenuItems should be changed with a different image when pressed or selected). Some sample code would be nice. I looked up a lot of solutions but not many of them made a clear explanation.

how to show menu item under overflow icon in android api 8+

无人久伴 提交于 2019-12-07 12:16:19
问题 How I can force menu item to show under overflow icon. I am providing app support from api level 8 and above. for now it is showing as actionview . My menuLayout is as follows. //main.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_menu_setting" android:title="@string/menuItemSetting" app:showAsAction="ifRoom"/> <item android:id="@+id/action_signout" android:title="@string/menuItemLogout"

Setting action bar title in ViewPager

ぐ巨炮叔叔 提交于 2019-12-07 11:36:35
问题 My ViewPager consists of many fragments .I am displaying title of fragment inside actionBar and i am using below code to set title .Since the ViewPager also initiates adjacent fragments I see in actionbar the title of next fragment.What should be the correct way to proceed in setting the title in actionbar of viewpager? private class MyPagerAdapter extends FragmentPagerAdapter { private String[] titles = { "Titleme", "Titletos", "Titleos", "Titles", "MeTitle5", "Title6", "Title7", "Title8" };

Can't find Android Compatibility Package on SDK Manager

吃可爱长大的小学妹 提交于 2019-12-07 11:26:03
问题 I want to start learning to work with Fragments and I want to install the Compatibility package for pre 3.0 versions of Android. However, I can't seem to find this package on the SDK manager. Here's everything I see: Also, I want to install Action Bar Sherlock to work with Action Bars. On the ACS website it says "If you’re using the Eclipse Development Environment with the ADT plugin version 0.9.7 or greater you can include this as a library project" - how do I include library projects?

Android ActionBar ActionProvider submenu

雨燕双飞 提交于 2019-12-07 10:08:54
问题 I just can't get the ActionProvider to show a submenu and I don't undestand why. I have my menu defined in xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/dossier_menu" android:showAsAction="always" android:actionProviderClass="com.some.other.mockup.MActionProvider"> </item> </menu> action provider class: public class MActionProvider extends ActionProvider { private static final String TAG = "MActionProvider"

How to update the Drop-down Navigation title when user selects an option?

白昼怎懂夜的黑 提交于 2019-12-07 09:19:26
I have a Drop-down Navigation (Spinner) in my Action Bar. For creating the spinner, I used the code below, on my onCreate() method: //SPINNER SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.main_options, android.R.layout.simple_spinner_dropdown_item); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); getActionBar().setListNavigationCallbacks(mSpinnerAdapter,this); main_options is a array in strings.xml resources, and has 3 options, which are shown on the Drop-down Navigation list (Spinner) when Activity is shown. Currently, the first option appears as

How to change the overflow button when in CAB?

和自甴很熟 提交于 2019-12-07 08:27:26
I have 2 different backgrounds to the Action bar. One light and another dark. One for the default title and another for the CAB (when some of the elements are selected/activated). I would like to have 2 different overflow when in those different states. I tried the selector but couldn't find the state to represent when in CAB mode. Any idea how to provide different overflow buttons? On a more general note, where can I start exploring the Action Bar so I could find the answers myself instead of finding bits and pieces all over the inet? I would expect Google/Android to provide a starting point.

Actionbar centered title with buttons

浪子不回头ぞ 提交于 2019-12-07 08:00:53
问题 I would like to center the title in the action bar, while having action icons next to it(and ignoring them for the gravity setting). I would like to have this: Instead I have this: Here is my code: ActionBar actionBar = getSupportActionBar(); ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.top_bar)); actionBar.setCustomView(LayoutInflater

Customize Padding of ActionBar Tabs Support

半腔热情 提交于 2019-12-07 06:49:14
问题 I want to remove the padding (spaces) between the tabs of the ActionBar. I am using the Android Support Library V7 (Appcompat) to use Fragments and the ActionBar in Android 2.2 API 8 as minSDK and 4.4 API 19 as maxSDK. I have tried the following but it does not change anything. My styles.xml <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light"> </style> <style name="AppTheme" parent="AppBaseTheme"> <item name="

How to fix cut-off custom SearchView background in landscape?

心不动则不痛 提交于 2019-12-07 05:46:44
问题 I've followed the great answer for this question to make the SearchView widget in my ActionBar fit a custom theme. It works just fine for portrait mode, but in landscape the OS will shrink the height of the ActionBar to maximize content screen estate. Instead of fitting the SearchView widget without margins into the ActionBar just like the other items, it is chopped off at the top: I've dug through the res-folder of the Android source, but could not find any specialized layouts or resources