Missing styles. Is the correct theme chosen for this layout?

后端 未结 21 1242
慢半拍i
慢半拍i 2020-11-28 19:27

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 ref

相关标签:
21条回答
  • 2020-11-28 20:14

    If you still have the problem after trying all the solutions above, please try modify the API Level as shown below. Incorrect API Level may also cause the problem.

    0 讨论(0)
  • 2020-11-28 20:14

    Most of the errors in XML happen due to the names you have given to the resources.

    Images stored in the drawable folder need to be named in a proper manner. just check these things:

    1. Are there any duplicate files? if so remove the duplicates. (For example "image.jpg" and "image.png" are not allowed in the same time. It will not show any errors but sometimes it will show that R.java cannot be resolved)
    2. Do the filenames contains any uppercase letters? If so right click on that file->refactor->rename and rename it with all lowercase, no hyphens, and only a-z and 0-9 are allowed.

    Just make sure of the above cases.

    0 讨论(0)
  • 2020-11-28 20:19

    This is very late but i like to share my experience this same issue. i face the same issue in Android studio i tried to some other solution that i found in internet but nothing works for me unless i REBUILD THE PROJECT and it solve my issue.

    Hope this will works for you too.

    Happy coding.

    0 讨论(0)
  • 2020-11-28 20:20

    In my case the problem occurred while the default setting for Android Version in the Designer was set to 'Preview N'. Changed Android Version to '23' and the error notification went away.
    Edit
    And don't forget to uncheck 'Automatically Pick Best'.

    0 讨论(0)
  • 2020-11-28 20:20

    I got the same problem with my customized theme that used Holo.Light as its parent. In grayed text Android Studio indicated that some attributes were missing. When I added these missing attributes as follows, the rendering problems went away -

        <item name="android:textEditSuggestionItemLayout"></item>
        <item name="android:textEditSuggestionContainerLayout"></item>
        <item name="android:textEditSuggestionHighlightStyle"></item>
    

    Even though they introduced errors in my style's theme, they caused no problems in rendering the activity designs or building my app.

    0 讨论(0)
  • 2020-11-28 20:26

    You can simply remove this error through change "App theme" and select any theme such as light. This error will be removed.

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