Android: Style ActionMode on AppCompat-v7 with Toolbar - android

I have made a ListView with selectable items but the ActionMode is not showing properly. (There is and a "compare" menu button on the right with white color)
I tried to style the actionMode with the following code but nothing changes. Any ideas why might this happens? I found out that if I set the background color direct on the Toolbar widget instead of the DarkTheme.ActionBar the color arround the text on actionMode is gone but still the color of the text is white and also I need to have the color of the ActionBar defined on the theme instead of the widget.
toolbar.xml
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/action_bar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
app:theme="#style/DarkTheme.ActionBar"
app:popupTheme="#style/DarkTheme.Popup"/>
mytheme.xml
<resources>
<style name="DarkTheme.ActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColorPrimary">#color/abc_primary_text_material_dark</item>
<item name="actionMenuTextColor">#color/abc_primary_text_material_dark</item>
<item name="android:textColorSecondary">#ffff8800</item>
<item name="android:textAllCaps">false</item>
<item name="android:background">#303030</item>
</style>
<style name="DarkTheme.Popup" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:textColor">#ffffff</item>
</style>
<style name="DarkTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textColor">#101010</item>
<item name="android:textColorLink">#ff0099cc</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:colorPrimaryDark">#000000</item>
<item name="android:navigationBarColor">#000000</item>
<item name="android:textAllCaps">false</item>
<item name="android:actionModeStyle">#style/DarkTheme.ActionMode</item>
</style>
<style name="DarkTheme.ActionMode" parent="Widget.AppCompat.ActionMode">
<item name="android:actionModeBackground">#android:color/black</item>
<item name="android:background">#000000</item>
<item name="android:backgroundSplit">#000000</item>
</style>
</resources>

I don't realy understand your stuff, it looks strange.
Theme are for Activity or Application in the manifest. For widget you should use style.
When looking at your question, I think, you just don't know how to use theme and what themes are for.
So your theme should looks like a stuff like that:
<resources>
<style name="AppBlankTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="colorAccent">#color/accent</item>
</style>
<!--Both themes below are those accepted to make the ToolBar works-->
<!-- Base application theme. -->
<style name="AppTheme" parent="AppBlankTheme">
<!-- Customize your theme here. -->
<!-- Base application theme. -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
<style name="MyAppTheme" parent="Theme.AppCompat.NoActionBar"/>
<!--The Theme for the Actvity that have actionMode-->
<style name="ActionModeAppTheme" parent="AppTheme">
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">#color/primary_dark</item>
<item name="actionBarPopupTheme">#style/ThemeOverlay.AppCompat.Light</item>
</style>
</resources>
Then your manifest you looks like something like that:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android2ee.formation.lollipop.toolbar" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".sample.ActivityWithItems"
android:label="#string/title_activity_activity_with_items"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.android2ee.formation.lollipop.toolbar.MainActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.android2ee.formation.lollipop.toolbar.EXAMPLE" />
</intent-filter>
</activity>
<activity
android:name=".sample.ActionModeActivity"
android:label="#string/title_activity_actionmode"
android:theme="#style/ActionModeAppTheme"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.android2ee.formation.lollipop.toolbar.MainActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.android2ee.formation.lollipop.toolbar.EXAMPLE" />
</intent-filter>
</activity>
</application>
</manifest>
And your activity looks like something like that:
public class ActionModeActivity extends AppCompatActivity {
ActionMode mMode;
/**
* The action Bar
*/
private ActionBar actionBar;
private Toolbar toolbar;
Callback actionModeCallBack;
private boolean postICS,postLollipop;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//You could also hide the action Bar
// getSupportActionBar().hide();
setContentView(R.layout.activity_action_mode);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_action_custom_up);
postICS =getResources().getBoolean(R.bool.postICS);
postLollipop =getResources().getBoolean(R.bool.postLollipop);
if(postLollipop){
toolbar.setElevation(15);
}
setSupportActionBar(toolbar);
actionBar=getSupportActionBar();
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
// Show the Up button in the action bar.
findViewById(R.id.start_actionmode).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
enableActionMode();
}
});
findViewById(R.id.stop_actionmode).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
if (mMode != null) {
//To quit the ActionMode
mMode.finish();
}
}
});
actionModeCallBack=new Callback() {
#Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
#Override
public void onDestroyActionMode(ActionMode mode) {
}
#Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
getMenuInflater().inflate(R.menu.action_mode, menu);
return true;
}
#Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
Toast.makeText(ActionModeActivity.this, "Got click: " + item, Toast.LENGTH_SHORT).show();
mode.finish();
return true;
}
};
}
private void enableActionMode() {
mMode = startSupportActionMode(actionModeCallBack);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_activity_with_items, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}

Related

error in extend activity You need to use a Theme.AppCompat theme

I am styling the action bar. I am having this error You need to use a Theme.AppCompat theme (or descendant) with this activity I know I should extend Activity in my main activity however I am extending AppCompatActivity because I am using this code setSupportActionBar(toolbarTop); If I removed AppCompatActivity will not work therefor I will not be able to use bottom toolbar;
this is my code
public class MainActivity extends AppCompatActivity {
...
private void initToolbars() {
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top);
setSupportActionBar(toolbarTop);
Toolbar toolbarBottom = (Toolbar) findViewById(R.id.drawer_layout);
toolbarBottom.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
#Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
// Single menu item is selected do something
// Ex: launching new activity/screen or show alert message
Toast.makeText(MainActivity.this, "Bookmark is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_save:
Toast.makeText(MainActivity.this, "Save is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_search:
Toast.makeText(MainActivity.this, "Search is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_share:
Toast.makeText(MainActivity.this, "Share is Selected", Toast.LENGTH_SHORT).show();
return true;
}
return true;
}
});
toolbarBottom.inflateMenu(R.menu.menu_main);
}
manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.je.www.i" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomActionBarTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
styles
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#FF0000</item>
</style>
</resources>
Your Theme should be like
<style name="CustomActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">
set parent as Theme.AppCompat.Light.DarkActionBar
Change your theme like
<style name="CustomActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowActionBar">false</item>
<item name="windowActionBar">false</item>
</style>
this way you will not request the ActionBar and you should be able to use the toolbar, or better use Theme.AppCompat.Light.NoActionBar, since you want to use the ToolBar and you don't need the ActionBar. Using Theme.AppCompat.Light.NoActionBar you don't need to provide the flag windowActionBar to your style

ActionBarCompat custom style

I use Android 4.2 and minSdkVersion 17 and the application is for tablet.
i can modify the default theme (change only color for my actionbar) with my but not found.
the my manifest is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.example.customtheme" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
My style.xml is:
<resources>
<style name="AppTheme" parent="#style/Theme.AppCompat">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#A2a</item>
</style>
and MainActivity is:
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
the layout is banal
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".MainActivity">
</RelativeLayout>
The my problem is:
the actionbar is not color (#a2a) but is black
To fix this problem please update your styles.xml as following:
<resources>
<style name="AppTheme" parent="#style/Theme.AppCompat">
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#color/ab_color</item>
<item name="background">#color/ab_color</item>
</style>
</resources>
line <item name="background">#color/ab_color</item> was added and color was moved to colors.xml because aapt could fail to parse it otherwise.
and your colors.xml:
<resources>
<color name="ab_color">#a2a</color>
</resources>
More details about this case: https://developer.android.com/training/basics/actionbar/styling.html

How to display Android Action Bar Logo

I am following the Android Developers Guild
I want to have the green robot logo on the very left hand side of the action bar
http://developer.android.com/images/training/basics/actionbar-theme-custom#2x.png
but I do not have the logo on action bar at all. I have searched for a few days, still can not locate an answer for this.
Please help, thanks!
src/.../MainActivity.java
public class MainActivity extends ActionBarActivity {
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().setDisplayUseLogoEnabled(true);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.action_bar, menu);
return super.onCreateOptionsMenu(menu);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.id.action_tab:
ActionBar.openTab(this);
return true;
case R.id.action_search:
ActionBar.openSearch(this);
return true;
case R.id.action_settings:
ActionBar.openSettings(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/** Called when the user clicks the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
menu/action_bar.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- Tab, should appear as action button -->
<item android:id="#+id/action_tab"
android:title="#string/action_tab"
app:showAsAction="always" /> <!-- you can change "always" to "ifRoom" -->
<!-- Search, should appear as action button -->
<item android:id="#+id/action_search"
android:icon="#drawable/ic_action_search"
android:title="#string/action_search"
app:showAsAction="always" /> <!-- you can change "always" to "ifRoom|withText" -->
<!-- Settings, should always be in the overflow -->
<item android:id="#+id/action_settings"
android:title="#string/action_settings"
app:showAsAction="never" />
</menu>
res/values/themes.xml
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionMenuTextColor">#color/actionbar_otherthantitleandoverflowtext</item>
<item name="android:windowActionBarOverlay">false</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionMenuTextColor">#color/actionbar_otherthantitleandoverflowtext</item>
<item name="windowActionBarOverlay">false</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#color/actionbar_background</item>
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<!-- Support library compatibility -->
<item name="background">#color/actionbar_background</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText"
parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/actionbar_titletext</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
</resources>
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:logo="#drawable/ic_launcher"
android:theme="#style/CustomActionBarTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName=".MainActivity" >
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" />
</activity>
</application>
</manifest>

Why won't my ActionBar show

I have my values-v11/styles.xml file as follows, but the ActionBar won't show on my Nexus 5 (API 19). It manages to style the TextView and background, so the Theme is being set, just not with the ActionBar. What's going wrong?
styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Base application theme. -->
<style name="AppTheme" parent="#style/Theme.AppCompat">
<item name="android:textViewStyle">#style/AppTheme.TextView</item>
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/ab_solid</item>
</style>
<style name="AppTheme.TextView" parent="android:Widget.TextView" >
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">10dp</item>
<item name="android:gravity">center</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
<style name="AppTheme.TextView.Header">
<item name="android:textColor">#666666</item>
</style>
</resources>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="uk.lobsterdoodle.kkworkhours.app" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="uk.lobsterdoodle.kkworkhours.app.WeekActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package uk.lobsterdoodle.kkworkhours.app;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TableRow;
public class WeekActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_schedule);
...some non-actionbar related stuff...
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.week, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}

Actionbarsherlock - Title not displaying

I've seen a few posts about getting the title to show in actionbarsherlock along with the icon. The icon is displaying fine, but the title does not show beside it.
Currently it shows the home icon with all the tabs beside it. What I am looking for is the home icon, then title, and below all this have the tabs show. Here is my code.
ACTIVITY
public class MainActivity extends SherlockFragmentActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mJsonHandler = JsonHandler.getInstance(this);
}
#Override
public boolean onCreateOptionsMenu(Menu menu)
{
com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowTitleEnabled(true);
ab.setDisplayShowHomeEnabled(true);
ab.setDisplayUseLogoEnabled(true);
ab.setTitle("TITLE TO SHOW");
inflater.inflate(R.menu.activity_main, menu);
return super.onCreateOptionsMenu(menu);
}
#Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch(item.getItemId()) {
case R.id.menu_item0:
break;
case R.id.menu_item1:
break;
case R.id.menu_item2:
break;
case R.id.menu_item3:
break;
case R.id.menu_item4:
break;
case R.id.menu_item5:
break;
default:
this.onBackPressed();
break;
}
return false;
}
}
activity_main.xml (for menu)
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/menu_item0"
android:orderInCategory="1"
android:showAsAction="always"
android:title="#string/menu_item0"/>
<item
android:id="#+id/menu_item1"
android:orderInCategory="2"
android:showAsAction="always"
android:title="#string/menu_item1"/>
<item
android:id="#+id/menu_item2"
android:orderInCategory="3"
android:showAsAction="always"
android:title="#string/menu_item2"/>
<item
android:id="#+id/menu_item3"
android:orderInCategory="4"
android:showAsAction="always"
android:title="#string/menu_item3"/>
<item
android:id="#+id/menu_item4"
android:orderInCategory="5"
android:showAsAction="always"
android:title="#string/menu_item4"/>
<item
android:id="#+id/menu_item5"
android:orderInCategory="6"
android:showAsAction="always"
android:title="#string/menu_item5"/>
Manifest
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Sherlock.Theme" >
<activity
android:name=".activities.MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Sherlock Theme
<style name="Sherlock.Theme" parent="Theme.Sherlock.Light.DarkActionBar">
</style>
You're setting too many menu items to always show in the ActionBar. You should only set the most important ones to do so. You should read through the Android Design Guidelines on the appropriate way to set up the ActionBar
Android Design Guidelines - Action Bar organization
Also, you should set up the ActionBar in onCreate and leave onCreateOptionsMenu for only inflating your menu(s). This is just a general tip and goes towards better, more professional code formatting.

Categories

Resources