To get a Foursquare view, you donโt need to think about creating a layout over tabs. When using the Actionbar Sherlock you only need to worry:
- Create a background for the top bar
- menu.xml, ActionbarSherlock , ( , Actionbar thw).
, 1. 2. styles.xml( res) :
<style name="Theme.Example" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="absForceOverflow">true</item>
</style>
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar.Solid">
<item name="background">@drawable/actionbar_background</item> <-- the background for top bar
<item name="icon">@drawable/actionbar_logo</item> <-- the logo that goes top left in the top bar
<item name="backgroundSplit">@drawable/bg_striped_split</item> <-- the image used between the menu items
</style>
3. , , menu.xml( ( , res)):
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_prefs"
android:icon="@drawable/settings_icon"
android:title="Preferences"
android:showAsAction="ifRoom" />
</menu>
, , , - :
@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:
intent = new Intent(getBaseContext(), Preferences.class);
startActivity(intent);
break;
}
return false;
}