Actionbar不会显示在设备中,但在模拟器中会显示

时间:2015-06-18 07:56:57

标签: android android-emulator android-actionbar android-manifest

我一直在开发应用程序,我使用模拟器作为测试人员。当应用程序完成后,我在Android 5和4中测试了它,但Actionbar就不会出现了。模拟器的平台是5.1.1作为我测试它的第一部手机。我脑子里唯一想到的是可能包含错误的清单文件,这里是:

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.flexenergy.swapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/myActionBarTheme" >
        <activity
            android:name="com.flexenergy.swapp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

另一件事,我在左侧有一个可绘制的列表视图菜单,按下操作栏(未显示),但如果我从左向右滑动手指,它会出现。

唯一的styles.xml如下(我将它放在values-v22,values-v11等中):

    <?xml version="1.0" encoding="utf-8"?>
<resources>
    <!--theme applied to the application or activity-->
    <style name="myActionbarTheme" parent="android:Theme.Holo">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="android:actionMenuTextColor">@color/lightBlue</item>
    </style>

    <!-- actionBar styles -->
    <style name="MyActionBar" parent="android:Widget.Holo.ActionBar">
        <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
    </style>

    <!-- actionBar title text -->
    <style name="MyActionBarTitleText" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">@color/lightBlue</item>
        <item name="android:textSize">20sp</item>

    </style>

    <!-- actionBar tabs text styles -->
    <style name="MyActionBarTabText" parent="android:Widget.Holo.ActionBar.TabText">
        <item name="android:textColor">@color/lightBlue</item>
    </style>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

0 个答案:

没有答案