Reputation: 473
I am making a action bar using sherlock action bar but it is not shown when i run it.This is the code:
public class NaseebactionbarActivity extends SherlockActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ActionBar actionbar = getSupportActionBar();
actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.Tab PlayerTab = actionbar.newTab().setText("Fragment A");
ActionBar.Tab StationsTab = actionbar.newTab().setText("Fragment B");
actionbar.addTab(PlayerTab);
actionbar.addTab(StationsTab);
actionbar.show();
}
please tell me what is the problem and how to solve it.
Upvotes: 0
Views: 577
Reputation: 31
Extend your Activity
from SherlockFragmentActivity
instead of SherlockActivity
:
public class MyActivity extends SherlockFragmentActivity {
// ...
}
Upvotes: 2
Reputation: 3889
In your AndroidManifest, be sure to set the theme of your application to :
android:theme="@style/Theme.Sherlock"
Upvotes: 1