Android 主题。全息不';行不通

Android 主题。全息不';行不通,android,Android,我是个新手,我不能解决主题的问题。我使用Android Studio,我有一个标准的“hello world”应用程序,我试图在上面使用Theme.Holo,所以我在清单文件中将我的minSdkVersion设置为“11”(我知道它只能在11及以上版本上使用)。然后在styles.XML中,我将AppTheme更改为android:Theme.Holo。我可以在预览中看到主题已正确更改,但当我在手机上运行我的应用程序(Android 4.2.2 API 17)时,出现错误“应用程序已停止”。当我

我是个新手,我不能解决主题的问题。我使用Android Studio,我有一个标准的“hello world”应用程序,我试图在上面使用Theme.Holo,所以我在清单文件中将我的
minSdkVersion
设置为
“11”
(我知道它只能在11及以上版本上使用)。然后在styles.XML中,我将AppTheme更改为
android:Theme.Holo
。我可以在预览中看到主题已正确更改,但当我在手机上运行我的应用程序(Android 4.2.2 API 17)时,出现错误“应用程序已停止”。当我回到标准
Theme.AppCompat.Light.darkaActionBar
时,应用程序正常启动

我还试图通过
android:Theme=“@android:style/Theme.Holo”在
application
的manifest文件中直接应用Theme.Holo,但它不会显示在预览中,并且在尝试在手机上运行时也会被停止。

我真的找遍了所有的答案,这是开始非常令人沮丧,有人可以帮我这个吗

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mycompany.actiobar_app" >

    <uses-sdk android:minSdkVersion="11" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".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>
logcat

02-03 20:47:10.546  24023-24023/? E/SharedPreferenceProvider﹕ onCreate
02-03 20:47:11.226    598-24036/? E/android.os.Debug﹕ !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
02-03 20:47:12.500  24082-24082/? E/SPPClientService﹕ ============PushLog. commonIsShipBuild. stop!
02-03 20:47:12.500  24082-24082/? E/SPPClientService﹕ [PushClientApplication] Push log off : This is Ship build version
02-03 20:47:12.789     116-9832/? E/AudioPolicyService﹕ getParamFromPolicy : enter , keys = situation=1;device=0
02-03 20:47:12.796     116-9832/? E/audio_policy_mrvl﹕ mrvl_ap_getParamFromPolicy: situation=1;device=0
02-03 20:47:12.882      598-649/? E/ViewRootImpl﹕ sendUserActionEvent() mView == null
02-03 20:47:12.882      598-609/? E/EnterpriseContainerManager﹕ ContainerPolicy Service is not yet ready!!!
02-03 20:47:17.664  24206-24229/? E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
02-03 20:47:18.117  26884-26884/? E/AuthorizationBluetoothService﹕ Proximity feature is not enabled.
02-03 20:47:30.312     598-1004/? E/Watchdog﹕ !@Sync 5949
02-03 20:47:42.750      598-664/? E/lights﹕ write_int failed to open -1
02-03 20:47:47.914      598-649/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null])
02-03 20:47:47.976      598-649/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null])
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.093      598-647/? E/SoundPool﹕ error loading /system/media/audio/ui/lens_flare_tap.ogg
02-03 20:47:48.093      598-647/? E/SoundPool﹕ error loading /system/media/audio/ui/lens_flare_unlock.ogg
02-03 20:47:48.210      598-649/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null])
02-03 20:48:00.312     598-1004/? E/Watchdog﹕ !@Sync 5950
02-03 20:48:30.312     598-1004/? E/Watchdog﹕ !@Sync 5951
02-03 20:49:00.320     598-1004/? E/Watchdog﹕ !@Sync 5952
02-03 20:49:06.390  24306-24306/? E/Samsung TTS﹕ onIsLanguageAvailable() - lang : pol, country : POL, variant : , iResult : -2
02-03 20:49:06.390  24306-24306/? E/﹕ Samsung TTS Engine - initialize() : Samsung TTS Engine (released - 201302151)
02-03 20:49:06.390  24306-24306/? E/﹕ Samsung TTS Engine - initialize() : ro.product.manufacturer - samsung
02-03 20:49:06.625  24306-24320/? E/Samsung TTS﹕ onIsLanguageAvailable() - lang : eng, country : USA, variant : , iResult : 1
02-03 20:49:06.625  24306-24320/? E/Samsung TTS﹕ onLoadLanguage() - LANG_COUNTRY_AVAILABLE
02-03 20:49:06.625  24306-24320/? E/Samsung TTS﹕ onLoadLanguage() - lang : eng, country : USA, variant : f01
02-03 20:49:30.320     598-1004/? E/Watchdog﹕ !@Sync 5953
02-03 20:50:00.320     598-1004/? E/Watchdog﹕ !@Sync 5954
02-03 20:50:30.320     598-1004/? E/Watchdog﹕ !@Sync 5955
02-03 20:50:40.960    2639-2639/? E/SPPClientService﹕ [[PushClientService]] onStartCommand. F:false, D:false, E:false, T:false, S:false, R:false
02-03 20:51:00.320     598-1004/? E/Watchdog﹕ !@Sync 5956
02-03 20:51:30.320     598-1004/? E/Watchdog﹕ !@Sync 5957
02-03 20:51:41.320  20425-20463/? E/PlayEventLogger﹕ Upload failed class java.net.UnknownHostException(Unable to resolve host "play.googleapis.com": No address associated with hostname)
02-03 20:52:00.328     598-1004/? E/Watchdog﹕ !@Sync 5958
02-03 20:52:30.328     598-1004/? E/Watchdog﹕ !@Sync 5959
02-03 20:53:00.328     598-1004/? E/Watchdog﹕ !@Sync 5960
02-03 20:53:30.328     598-1004/? E/Watchdog﹕ !@Sync 5961
02-03 20:54:00.328     598-1004/? E/Watchdog﹕ !@Sync 5962
02-03 20:54:30.328     598-1004/? E/Watchdog﹕ !@Sync 5963
02-03 20:55:00.328     598-1004/? E/Watchdog﹕ !@Sync 5964
02-03 20:55:30.335     598-1004/? E/Watchdog﹕ !@Sync 5965
02-03 20:56:00.335     598-1004/? E/Watchdog﹕ !@Sync 5966

我猜您的
活动可能正在扩展
ActionBarActivity
,这意味着您使用
AppCompat
主题(或后代)。

显示您的日志猫。嘿,我添加了日志猫,你能检查一下吗?我认为在API 11之后,你可以在每个应用程序中使用Theme.Holo…你知道我如何绕过它吗?发布你的
活动
和Logcat代码,这样我们就可以看到正在发生的事情了。刚刚添加了Activity和Logcat,希望这就是Logcat的意思,我只按错误过滤,因为行太多,我不知道如何停止我怀疑的会话。您正在使用
ActionBarActivity
,这需要
AppCompat
。这是标准代码,我还不知道所有这些是如何工作的,那么使用
主题的代码应该是什么样子的。Holo
?我读过支持库:“
android.support.v7.app.ActionBar
当使用支持库时。•
android.app.ActionBar
当仅为API 11级或更高级别开发时。”v7库只能使用
AppCompat
及其子体,所以我认为我应该使用
android.app.ActionBar
库,但如何使用?
package com.mycompany.actiobar_app;

import android.app.ActionBar;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class MainActivity extends ActionBarActivity {

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


    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
02-03 20:47:10.546  24023-24023/? E/SharedPreferenceProvider﹕ onCreate
02-03 20:47:11.226    598-24036/? E/android.os.Debug﹕ !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
02-03 20:47:12.500  24082-24082/? E/SPPClientService﹕ ============PushLog. commonIsShipBuild. stop!
02-03 20:47:12.500  24082-24082/? E/SPPClientService﹕ [PushClientApplication] Push log off : This is Ship build version
02-03 20:47:12.789     116-9832/? E/AudioPolicyService﹕ getParamFromPolicy : enter , keys = situation=1;device=0
02-03 20:47:12.796     116-9832/? E/audio_policy_mrvl﹕ mrvl_ap_getParamFromPolicy: situation=1;device=0
02-03 20:47:12.882      598-649/? E/ViewRootImpl﹕ sendUserActionEvent() mView == null
02-03 20:47:12.882      598-609/? E/EnterpriseContainerManager﹕ ContainerPolicy Service is not yet ready!!!
02-03 20:47:17.664  24206-24229/? E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
02-03 20:47:18.117  26884-26884/? E/AuthorizationBluetoothService﹕ Proximity feature is not enabled.
02-03 20:47:30.312     598-1004/? E/Watchdog﹕ !@Sync 5949
02-03 20:47:42.750      598-664/? E/lights﹕ write_int failed to open -1
02-03 20:47:47.914      598-649/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null])
02-03 20:47:47.976      598-649/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null])
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.000      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.046      598-647/? E/LSO﹕ LSO Service is not yet ready!!!
02-03 20:47:48.093      598-647/? E/SoundPool﹕ error loading /system/media/audio/ui/lens_flare_tap.ogg
02-03 20:47:48.093      598-647/? E/SoundPool﹕ error loading /system/media/audio/ui/lens_flare_unlock.ogg
02-03 20:47:48.210      598-649/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null])
02-03 20:48:00.312     598-1004/? E/Watchdog﹕ !@Sync 5950
02-03 20:48:30.312     598-1004/? E/Watchdog﹕ !@Sync 5951
02-03 20:49:00.320     598-1004/? E/Watchdog﹕ !@Sync 5952
02-03 20:49:06.390  24306-24306/? E/Samsung TTS﹕ onIsLanguageAvailable() - lang : pol, country : POL, variant : , iResult : -2
02-03 20:49:06.390  24306-24306/? E/﹕ Samsung TTS Engine - initialize() : Samsung TTS Engine (released - 201302151)
02-03 20:49:06.390  24306-24306/? E/﹕ Samsung TTS Engine - initialize() : ro.product.manufacturer - samsung
02-03 20:49:06.625  24306-24320/? E/Samsung TTS﹕ onIsLanguageAvailable() - lang : eng, country : USA, variant : , iResult : 1
02-03 20:49:06.625  24306-24320/? E/Samsung TTS﹕ onLoadLanguage() - LANG_COUNTRY_AVAILABLE
02-03 20:49:06.625  24306-24320/? E/Samsung TTS﹕ onLoadLanguage() - lang : eng, country : USA, variant : f01
02-03 20:49:30.320     598-1004/? E/Watchdog﹕ !@Sync 5953
02-03 20:50:00.320     598-1004/? E/Watchdog﹕ !@Sync 5954
02-03 20:50:30.320     598-1004/? E/Watchdog﹕ !@Sync 5955
02-03 20:50:40.960    2639-2639/? E/SPPClientService﹕ [[PushClientService]] onStartCommand. F:false, D:false, E:false, T:false, S:false, R:false
02-03 20:51:00.320     598-1004/? E/Watchdog﹕ !@Sync 5956
02-03 20:51:30.320     598-1004/? E/Watchdog﹕ !@Sync 5957
02-03 20:51:41.320  20425-20463/? E/PlayEventLogger﹕ Upload failed class java.net.UnknownHostException(Unable to resolve host "play.googleapis.com": No address associated with hostname)
02-03 20:52:00.328     598-1004/? E/Watchdog﹕ !@Sync 5958
02-03 20:52:30.328     598-1004/? E/Watchdog﹕ !@Sync 5959
02-03 20:53:00.328     598-1004/? E/Watchdog﹕ !@Sync 5960
02-03 20:53:30.328     598-1004/? E/Watchdog﹕ !@Sync 5961
02-03 20:54:00.328     598-1004/? E/Watchdog﹕ !@Sync 5962
02-03 20:54:30.328     598-1004/? E/Watchdog﹕ !@Sync 5963
02-03 20:55:00.328     598-1004/? E/Watchdog﹕ !@Sync 5964
02-03 20:55:30.335     598-1004/? E/Watchdog﹕ !@Sync 5965
02-03 20:56:00.335     598-1004/? E/Watchdog﹕ !@Sync 5966