Android layout error: “Resource id <res_id> is not of type STYLE (instead attr)”

六月ゝ 毕业季﹏ 提交于 2019-11-28 22:44:01

I also have this problem, with the same resource ID showing up. It disappears when I change android:spinnerMode to "dialog" so I suspect it's not a problem with your code.

The id in question refers to the android attribute spinnerStyle. See the doc for R.attr

I found a workaround, namely replace

android:spinnerMode="dropdown"

with

android:spinnerStyle="@android:style/Widget.Spinner.DropDown".

Have you tried changing the each style property to something like this:

style="?attr/text_large_bold_white"
Carlos Gómez

As JulianSymes says the problem is

android:spinnerMode="dropdown"

His solution (replace for android:spinnerStyle="@android:style/Widget.Spinner.DropDown") runs on my phone but not on my tablet

My solution is more simple: DELETE THE LINE.

spinnerMode="dropdown" is by default, therefore it's unnecesary

Delete all style elements and then add them one after another and always check if it still renders. So you can at least find out which one's to blame.

As Google points to this page for this error, and for the sake of posterity...

In my case, in a whim, I closed and reopened eclipse and boom the error was gone and eclipse had no problem rendering the preview.

Though I strongly believe this may not be the case for all.

If you feel you have done everything right, I guess, it won't hurt restarting eclipse.

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