Tag: android-actionbar

Android ActionBar setCheckable() not working

I’m trying to make one of the MenuItems on my Menu have a checkmark ability, but it doesn’t seem to work. All other MenuItems are working, this one does too, except for the checkmark display. What am I doing wrong? MenuItem actionPickMode = menu.add(0, 3, 0, “pickmode”); actionPickMode.setTitle(“Pick Mode”); actionPickMode.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS); actionPickMode.setVisible(true); actionPickMode.setCheckable(true);

ActionBar in PreferenceFragment not recalculating height and font size

Using the latest AppCompat-v21 library, I used ActionBarActivity to create and populate the PreferenceFragment. However, the ActionBar does not seem to change height and the text size when the orientation or screen size is altered. Testing this on other activities as well, this behavior only seems to be happening in PreferenceActivity (opposed to this question […]

Android- hide actionbar during startup and then show it again?

My android app has tab navigation using an action bar. It works well, but it bothers me that during the first boot of the app, a small default action bar briefly shows up before being replaced by the real, tab-navigation action bar. My onCreate starts like this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); […]

Android Actionbar change menus position

I’m trying to use android-support-v7-appcompat and my problem change menus position to right of actionbar As you can see on the attached picture I wanna change the position of menu in action bar with custom view which is inflate of a custom layout.. hope to understand what I’m say

ActionBar with navigation tabs changes height with screen orientation

My goal is to increase the ActionBar height for portrait mode. I currently set android:actionBarSize in my Themes.xml. <?xml version=”1.0″ encoding=”utf-8″?> <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”DayTheme” parent=”android:style/Theme.Holo.Light”> <item name=”android:actionBarSize”>@dimen/actionBarHeight</item> <item name=”android:actionBarTabTextStyle”>@style/tab_indicator_text_dark</item> </style> <style name=”NightTheme” parent=”android:style/Theme.Holo”> <item name=”android:actionBarSize”>@dimen/actionBarHeight</item> <item name=”android:actionBarTabTextStyle”>@style/tab_indicator_text_light</item> </style> </resources> I get the desired effect in landscape mode where I have increased the ActionBar height […]

Align ActionBar Navigation Tab icons above the tab text?

The app has an ActionBar, and the ActionBar has Navigation Tabs, each containing text. I need to add icons to the tabs, in addition to the text. I have added the icons using ActionBar.Tab.setIcon(drawable) successfully, but the icon shows to the left of the tab text. How do I move the tab icon so it […]

onNavigationItemSelected in ActionBar is being called at startup how can avoid it?

I am using ActionBar with a dropdown menu, and onNavigationItemSelected() is called as soon as the Activity is created, so the first item is called. The first item of my dropdown menu is Home, the same action as pressing the application icon with android.R.id.home so when application starts it calls itself. To avoid this from […]

How to implement dynamic values on menu item in Android

I have a menu item in the action bar. Along with the menu item image, I need to show some number associated with it which will change often. I am not using Action bar sherlock. I don’t want to use that. Other than this everything else just works fine. In the shown image, the white […]

searchManager.getSearchableInfo(getComponentName()) returns null

I’ve followed this Android guide in order to add a search bar to an activity. The setup looks like this: res/menu/activity_main.xml: <?xml version=”1.0″ encoding=”utf-8″?> <menu xmlns:android=”http://schemas.android.com/apk/res/android” > <item android:id=”@+id/search” android:title=”@string/menu_search” android:icon=”@android:drawable/ic_menu_search” android:showAsAction=”collapseActionView|ifRoom” android:actionViewClass=”android.widget.SearchView” /> <item android:id=”@+id/menu_settings” android:orderInCategory=”100″ android:showAsAction=”never” android:title=”@string/menu_settings” android:icon=”@drawable/ic_menu_settings”/> </menu> res/xml/searchable.xml: <?xml version=”1.0″ encoding=”utf-8″?> <searchable xmlns:android=”http://schemas.android.com/apk/res/android” android:label=”@string/app_name” android:hint=”@string/search_hint” /> Activity entry in manifest file: […]

Cannot cast from ActionProvider to ShareActionProvider

I am trying to implement a ShareActionProvider in my ActionBarSherlock. The following code gives me this error : Cannot cast from ActionProvider to ShareActionProvider ReadingActivity.java @Override public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.menu2b, (Menu) menu); menu.getItem(0).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS|MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.getItem(1).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS|MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem menuItem = menu.findItem(R.id.share); // Get the provider and hold onto it to set/change the […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.