没有资源的发现,匹配给定的名字:ATTR“机器人:tabLayout” [英] No resource found that matches the given name: attr 'android:tabLayout'

查看:162
本文介绍了没有资源的发现,匹配给定的名字:ATTR“机器人:tabLayout”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用我自己的风格取代了风格自定义标签窗口小部件。 我要更换的产品如下:

I would like to customize tab widget by replacing the style with my own style. The item I am going to replace is as follow :

 <item name="android:tabLayout">@android:layout/tab_indicator_holo</item>

不过,我得到这个错误: 没有资源的发现,匹配给定的名字:ATTR机器人:tabLayout

But I got this error : No resource found that matches the given name: attr 'android:tabLayout'

我已经设置父样式是这样的:

I have set the parent style like this :

<style name="customTabWidget" parent="@android:style/Widget.Holo.TabWidget">

该项目建设目标:安卓4.0

The Project build target : Android 4.0

我还清理了项目,但错误依然退出。 如何修复错误?

I also have cleaned the project but the error still exits. How to fix the error?

在此先感谢。

推荐答案

我遇到了类似的问题。至少部分解决办法是添加tabLayout属性水库/价值/ attrs.xml。这里是TabWidget风格的定​​义,从Android-16平台的复制(注意末尾的tabLayout属性):

I encountered a similar problem. At least part of the solution is to add the tabLayout attribute to res/values/attrs.xml. Here is the definition of the TabWidget styles, copied from the android-16 platform (notice the tabLayout attribute at the end):

<declare-styleable name="TabWidget">
    <!-- Drawable used to draw the divider between tabs. -->
    <attr name="divider" />
    <!-- Determines whether the strip under the tab indicators is drawn or not. -->
    <attr name="tabStripEnabled" format="boolean" />
    <!-- Drawable used to draw the left part of the strip underneath the tabs. -->
    <attr name="tabStripLeft" format="reference" />
    <!-- Drawable used to draw the right part of the strip underneath the tabs. -->
    <attr name="tabStripRight" format="reference" />
    <!-- Layout used to organize each tab's content. -->
    <attr name="tabLayout" format="reference" />
</declare-styleable>

既然你重写,你也想改变:

Since you are overriding, you will also want to change:

 <item name="android:tabLayout">...

 <item name="tabLayout">...

这篇关于没有资源的发现,匹配给定的名字:ATTR“机器人:tabLayout”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆