Android Studio 1.2.1.1 - Failed to find style 'textViewStyle'

前端 未结 6 899
猫巷女王i
猫巷女王i 2020-12-30 20:01

I\'m new to Android development and I just installed Android Studio version 1.2.1.1. I created a project, HelloWorld, and chose the default blank activity, Darcula theme, an

相关标签:
6条回答
  • 2020-12-30 20:14

    Click on "Design" tab

    On the right pannel, search for the objet "text" that contains something like "@string/hello_world"

    Remove this value from the field

    There's no more error.

    0 讨论(0)
  • 2020-12-30 20:29

    Simply click on the Refresh icon at the review pane:

    0 讨论(0)
  • 2020-12-30 20:34

    Make sure to select the correct theme from the menu in the preview panel.

    If you set the layout file to be FullScreen in the manifest but select something like NoActionBar theme in the preview panel, you will also get this error.

    0 讨论(0)
  • 2020-12-30 20:34

    Go to manifest file, check the theme you are using there and pick the same in the Design view of your xml file.

    0 讨论(0)
  • 2020-12-30 20:35

    Rebooting Android Studio did the trick for me. I couldn't find the "Refresh" button in the accepted answer for some reason.

    0 讨论(0)
  • 2020-12-30 20:38

    Android gives you the option to define your own style format, which the default project you made did. It created a style named 'textViewStyle'.

    If you look at the text view instead of the design view (you can switch by pressing the tab at the lower left in the part where you get the error that it can't render) you will see that the textView or the app itself contains a line android:theme="@style/textViewStyle".

    You can either remove this line, or track down the error in the styles.xml file in the res/values folder. This is the file that defines the style for the app.

    If this doesn't help you it could be that the style is defined in your AndroidManifest.xml file, look at the tag, it will contain a line saying android:theme="@android:style/textViewStyle", change that to android:theme="@android:style/Theme.DeviceDefault" and you should be good to go.

    More info on custom themes: http://developer.android.com/guide/topics/ui/themes.html

    Since you are a beginner, more on general Android development: http://developer.android.com

    0 讨论(0)
提交回复
热议问题