Answer the question
In order to leave comments, you need to log in
How to add ActionBar or ToolBar to TabActivity?
there is an activity with tabs, but the actionbar is gone, how to add it to the tabactivity or the toolbar?
public class MainActivity extends TabActivity {
public android.support.v7.widget.Toolbar toolbar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost tabHost = getTabHost();
TabHost.TabSpec tabSpec;
Answer the question
In order to leave comments, you need to log in
TabActivity is deprecated (Deprecated since API level 13): https://developer.android.com/reference/android/ap...
I recommend using TabLayout from the Support design library: https://developer.android.com/reference/android/ su...
This is a regular ViewGroup: add it to the markup, find it in the code and initialize it.
This will help to avoid crutches with embedding Toolbar in TabActivity.
https://developer.android.com/topic/libraries/supp...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question