android:style reference after SDK and ADT plugin update in mid 2011

折月煮酒 提交于 2019-12-12 06:24:16

问题


I see a lot a similar questions R.java can't compile , No resource found that matches @android:style/ "just after SDK & ADT update" leading to existing projects can't compile The R.java file cannot be compiled. I find out the errors come from referencing

<style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper" >
    <item name="android:colorForeground">#fff</item>
</style>

What is happening is that some styles, like Theme.Wallpaper are not public. You should not extend from them anymore.

Some suggest to revert to platform_tools_r05 http://groups.google.com/group/android-developers/browse_thread/thread/550fce9670530d9b/9b2b2aa389dce367?show_docid=9b2b2aa389dce367&pli=1

If you want to do the correct way read Xavier July 28 http://groups.google.com/group/android-developers/browse_thread/thread/550fce9670530d9b/9b2b2aa389dce367?show_docid=9b2b2aa389dce367&pli=1

If you wish to reuse a style that is private, you should copy the content of that style into your own instead of extending it.

Ok so Where do I find the content of the (private) style ? Seriously, after an update I don't have time to correct platform mistakes when the project code worked right.


回答1:


<!-- Default theme for windows that want to have the user's selected
     wallpaper appear behind them.  -->
<style name="Theme.Wallpaper">
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowShowWallpaper">true</item>
</style>

Looks like you want to use the above code from the Android source and create your own theme based it.



来源:https://stackoverflow.com/questions/7258408/androidstyle-reference-after-sdk-and-adt-plugin-update-in-mid-2011

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!