Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Theme preview fails in Eclipse

I have made a simple username/password dialog to which I want to apply a theme (it basically defines windowBackground) and would also like to preview in Eclipse.

I see that my theme is displayed along other themes in the Theme combo box, but selecting it produces the following error:

Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.

Failed to find style 'textViewStyle' in current theme
android.content.res.Resources$NotFoundException
Couldn't find theme resource attr/textAppearanceLarge for the current theme
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- TextView (Change to android.widget.TextView, Fix Build Path, Edit XML)

Theme definition:

<style name="my_theme">
    <item name="android:windowBackground">@drawable/form_header</item>
    <!-- <item name="android:padding">0dp</item>-->
    <item name="android:windowNoTitle">true</item>
</style>

Debugging works fine. However WYSIWYG would be more appreciable.

like image 581
usr-local-ΕΨΗΕΛΩΝ Avatar asked Apr 24 '12 15:04

usr-local-ΕΨΗΕΛΩΝ


4 Answers

Close your layout files in the editor first and restart your Eclipse.

like image 128
Sibevin Wang Avatar answered Nov 03 '22 15:11

Sibevin Wang


I also got this problem. I solved it by changing theme. Steps to do this

  1. Open activity in "Graphic Layout"
  2. Click drop down list AppTheme (On top bar of activity "Graphic Layout")
  3. Select Project Themes->AppBaseTheme
like image 36
Tawtin Tom Avatar answered Nov 03 '22 17:11

Tawtin Tom


You should choose another theme in Graphic Layout (ex: default theme). I think your custom theme not support some attribute.

like image 5
duongvanthai Avatar answered Nov 03 '22 17:11

duongvanthai


Make sure your all other styles.xml present under different values contains your custom theme part.

I had similar problem. In my case I had added a custom theme in values-large folder under res. And it was working at runtime but giving error as yours in eclipse. So i tried adding the custom part(in my case totally there was 3 tags added to styles.xml file) in all other styles.xml file. i.e. styles.xml files under values-normal-hdpi, values-normal-mdpi, valuse-v11 and values-v14...

And BOOM!!! It solved my problem which wasted my whole day.

like image 3
Shirish Herwade Avatar answered Nov 03 '22 15:11

Shirish Herwade