android:style reference after SDK and ADT plugin u

2019-09-03 13:13发布

问题:

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.