1. 程式人生 > >安卓開發中Theme.AppCompat.Light的解決方法

安卓開發中Theme.AppCompat.Light的解決方法

col san 文件 輸入 安卓 light style match ont

styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下錯誤,這是版本問題。

error: Error retrieving parent for item: No resource found that matches the given name

‘Theme.AppCompat.Light‘.

解決方法:

在Eclipse中打開任意一個.java文件,輸入 android.R.style. 這時你會看到一個提示列表,仔細看看,再對比一下,看哪個與原有的最接近就選擇哪個。用將下劃線替換成"."就可了。

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">

改為

<style name="AppBaseTheme" parent="android:Theme.Light">

同理,將

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 改為
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">

安卓開發中Theme.AppCompat.Light的解決方法