I want to have an Action Bar like foursquare. What I want is tabs such as
To achieve a Foursquare look you do not need to be thinking of creating a layout above the tabs. When using Actionbar Sherlock you only need to worry about:
So, for 1. and 2. it's all about using styles.xml file (should reside in the values folder in the res folder) like so:
For 3. all you need to do is create menu items under menu.xml (should reside in the menu folder (if not there, create one in the res folder)):
The last thing you have to do to see the menu items is use these functions in the activity:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
public boolean onOptionsItemSelected (MenuItem item) {
Intent intent;
switch (item.getItemId())
{
case R.id.menu_prefs:
// Launch Preference Activity
intent = new Intent(getBaseContext(), Preferences.class);
startActivity(intent);
break;
}
return false;
}