Tag: android-actionbar

Android ActionBar compatibility: MenuItem.setActionView(View)

I’m using the appcompat7 lib for ActionBar backwards compatibility. Now I have a MenuItem that I retrieve, and then want to set an ImageView myView as its icon. The way how to do it from API level 11 is: MenuItem menuItemRefresh = menu.findItem(R.id.refresh); menuItemRefresh.setActionView(myView); For API levels lower than 11 this doesn’t work, the second […]

Removing app icon and text from ActionBar

Possible Duplicate: Remove application icon and title from Honeycomb action bar can this be done to free up more space in the ActionBar? I am compiling against sdk 15

Removing bottom shadow on ActionBar – Android

I want to disable ActionBar shadow but only in one Activity. If I use this code it will be change in whole aplication. <style name=”MyAppTheme” parent=”android:Theme.Holo.Light”> <item name=”android:windowContentOverlay”>@null</item> </style> I tried this code, but it is not working getSupportActionBar().setElevation(0); Any suggestion…?

Overflow Actions on ActionBar not showing

I have an ActionBar using ActionBar Sherlock where I need it to display overflow because I have more actions than room. But, it doesn’t show the overflow icon. Here is my configuration: <?xml version=”1.0″ encoding=”utf-8″?> <menu xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@+id/menu_search” android:icon=”@drawable/action_search” android:title=”@string/menu_search” android:showAsAction=”ifRoom|withText”/> <item android:id=”@+id/menu_library” android:icon=”@drawable/hardware_headphones” android:title=”@string/my_music” android:showAsAction=”ifRoom|withText”/> <item android:id=”@+id/menu_downloads” android:icon=”@drawable/av_download” android:title=”@string/downloads” android:showAsAction=”ifRoom|withText”/> </menu> And here […]

Manually inflating custom view yields different layouts for ActionBar custom view

Custom view from resource: // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setCustomView(R.layout.custom_action_bar); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); the result is: Custom view manually inflated: // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); LayoutInflater inflater = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.custom_action_bar, null); actionBar.setCustomView(view); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); the result is: custom_action_bar.xml: <?xml […]

Programmatically switch tabs in Android using ActionBarSherlock

I couldn’t find any info about this but, how can i programmatically switch tabs in ActionBarSherlock? Normally when i want to switch views i’d use something like: Intent intentSecondView = new Intent(this, SecondView.class); this.startActivity(intentSecondView); But obviously this doesn’t work, because the views in the tabs are fragments. So is there a way to switch between […]

Android support action bar not showing overflow menu

My android app supports 2.2 and higher. I’m using the appcompat support library for the action bar, so it should only show if there are things that don’t fit. I want my action bar to support the overflow button (the three vertical squares) that reveals a menu with the other items when clicked. In my […]

Android (3.0) Action Bar dont want to Go

I am working with XOOM and trying to hide action bar. So i follow the instruction did the following in manifest file: uses-sdk android:minSdkVersion=”11″ android:targetSdkVersion=”11″ also set activity theme. android:theme=”@android:style/Theme.Holo.NoActionBar” unfortunately i can still see the action bar. so i remove the holo action part from my manifest and added following code ActionBar actionBar = […]

ClassCastException: android.support.v7.widget.ShareActionProvider

I try to use my action bar and i got this execption 08-08 00:54:08.913: E/AndroidRuntime(18468): FATAL EXCEPTION: main 08-08 00:54:08.913: E/AndroidRuntime(18468): java.lang.ClassCastException: android.support.v7.widget.ShareActionProvider cannot be cast to android.view.ActionProvider 08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.MenuInflater$MenuState.readItem(MenuInflater.java:374) 08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.MenuInflater.parseMenu(MenuInflater.java:160) 08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.MenuInflater.inflate(MenuInflater.java:110) 08-08 00:54:08.913: E/AndroidRuntime(18468): at com.example.workoutlog.AddWorkOutPage.onCreateOptionsMenu(AddWorkOutPage.java:3190) 08-08 00:54:08.913: E/AndroidRuntime(18468): at android.app.Activity.onCreatePanelMenu(Activity.java:2490) 08-08 00:54:08.913: […]

Changing the Action bar icon

I’m currently implementing theme support for my application and a part of it is changing the action bar app icon. I want to use a dark icon when Holo Light is selected. Everything is done in the method except for the part where the action bar app icon is set. The code that im trying […]

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