Java Android Actionbar没有显示

Java Android Actionbar没有显示,java,android,android-actionbar,Java,Android,Android Actionbar,在我创建了自己的样式后,我的Actionbar没有出现。我正在使用带有tabhost的Pageviewer,它是可见的,但我的Actionbar不可见。我认为这是由我的Styles.xml造成的。我还尝试使用Android主题编辑器编辑主题,但没有帮助 这是my Styles.xml <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.Newme" parent="@style/

在我创建了自己的样式后,我的Actionbar没有出现。我正在使用带有tabhost的Pageviewer,它是可见的,但我的Actionbar不可见。我认为这是由我的Styles.xml造成的。我还尝试使用Android主题编辑器编辑主题,但没有帮助

这是my Styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Newme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="actionBarItemBackground">@drawable/selectable_background_newme</item>
    <item name="popupMenuStyle">@style/PopupMenu.Newme</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.Newme</item>
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Newme</item>
    <item name="actionDropDownStyle">@style/DropDownNav.Newme</item>
    <item name="actionBarStyle">@style/ActionBar.Solid.Newme</item>
    <item name="actionModeBackground">@drawable/cab_background_top_newme</item>
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_newme</item>
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Newme</item>           
    <item name="actionBarWidgetTheme">@style/Theme.Newme.Widget</item>

</style>

<style name="ActionBar.Solid.Newme" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
    <item name="background">@color/theme_color</item>
    <item name="backgroundStacked">@color/theme_color</item>
    <item name="backgroundSplit">@color/theme_color</item>
    <item name="progressBarStyle">@style/ProgressBar.Newme</item>
</style>

<style name="PopupMenu.Newme" parent="@style/Widget.AppCompat.PopupMenu">   
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_newme</item> 
</style>

<style name="DropDownListView.Newme" parent="@style/Widget.AppCompat.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_newme</item>
</style>

<style name="ActionBarTabStyle.Newme" parent="@style/Widget.AppCompat.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator_ab_newme</item>
</style>

<style name="DropDownNav.Newme" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
    <item name="android:background">@drawable/spinner_background_ab_newme</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_newme</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_newme</item>
</style>

<style name="ProgressBar.Newme" parent="@style/Widget.AppCompat.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_newme</item>
</style>

<style name="ActionButton.CloseMode.Newme" parent="@style/Widget.AppCompat.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_newme</item>
</style> 

<style name="Theme.Newme.Widget" parent="@style/Theme.AppCompat">
    <item name="popupMenuStyle">@style/PopupMenu.Newme</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.Newme</item>
</style>

显示活动代码使用,
AppCompactActivity
扩展您的类,这会给我一个错误您是否对Appcompact库进行分级?如果不这样使用,请编译“com.android.support:appcompat-v7:18.0.+”
package com.miguel.fitnessapp;

public class MainActivity extends FragmentActivity implements     OnTabChangeListener, OnPageChangeListener {

private TabsPagerAdapter mAdapter;
private ViewPager mViewPager;
private TabHost mTabHost;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mViewPager = (ViewPager) findViewById(R.id.viewpager);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        getWindow().setStatusBarColor(getResources().getColor(R.color.theme));
    }


    initialiseTabHost();
    mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
    // Fragments and ViewPager Initialization


    mViewPager.setAdapter(mAdapter);
    mViewPager.setOnPageChangeListener(MainActivity.this);
}


private static void AddTab(MainActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec) {
    tabSpec.setContent(new MyTabFactory(activity));
    tabHost.addTab(tabSpec);
}


public void onTabChanged(String tag) {
    int pos = this.mTabHost.getCurrentTab();
    this.mViewPager.setCurrentItem(pos);
}

@Override
public void onPageScrollStateChanged(int arg0) {
}

// Manages the Page changes, synchronizing it with Tabs
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
    int pos = this.mViewPager.getCurrentItem();
    this.mTabHost.setCurrentTab(pos);
}

@Override
public void onPageSelected(int arg0) {
}



private void initialiseTabHost() {
    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup();


    MainActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Training").setIndicator("Training"));
    MainActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Ernährung").setIndicator("Ernährung"));
    MainActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Körper").setIndicator("Körper"));

    mTabHost.setOnTabChangedListener(this);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main_menu_edit, menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle presses on the action bar items
    int id = item.getItemId();
    if (id == R.id.benutzer){

    }
    return super.onOptionsItemSelected(item);
}
}