海拔僅適用於Android 5.x +,因此您必須更改編譯爲使用5.0或更高版本。
您/Resources/values/style.xml應該或多或少是:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#00FFAA</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#004D40</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal.
<item name="colorControlNormal">#00897B</item>
<item name="colorControlActivated">#1DE9B6</item>-->
<item name="windowActionModeOverlay">true</item>
</style>
</resources>
還要檢查你的style.xml在你的/資源/文件夾值,並確保您爲API級別V21 +風格是這樣的:在BuildAction的/Resources/values-v21/style.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!--
Base application theme for API 21+. This theme replaces
MyTheme from resources/values/styles.xml on API 21+ devices.
-->
<style name="MyTheme" parent="MyTheme.Base">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
</resources>
我改變了編譯版本爲你描述:我擺脫錯誤的,但我得到另一個錯誤:java.lang.OutOfMemoryError。考慮增加$(JavaMaximumHeapSize)的值。 Java運行時內存不足,執行'java.exe –
@MohamedAhmed轉到您的Android選項 - >高級選項卡 - >高級Android構建設置並將Java堆大小設置爲1G,例如 – Ingenator
@Amit Kumar,我一直想知道...爲什麼他們甚至讓人們在那裏設置KitKat 4.4?是否有配置可以工作的場景? – Marshall