Android TabLayout CompatTextView无法解析
Android TabLayout CompatTextView can not be resolved
我正在使用 TabLayout,但是在我的 src 中复制它之后,出现以下错误:
(1) android.support.v7.internal.widget.CompatTextView can not be resolved
(2) styleable cannot be resolved or is not a field
虽然我在 Whosebug 中检查了其他答案,但未能得到正确的解决方案。我已经导入 android.R
(3) 我检查了 android-support-v7-appcompat.jar 中缺少 class CompatTextView。这怎么可能。
(4)如果我复制google给的TabLayout class给我的app会不会有什么法律问题?
请帮忙。
- 更新:
我添加了
import android.support.v7.appcompat.R;
而不是 android.R
并出现了一些错误,例如 Widget_Design_TabLayout cannot be resolved or is not a field
TabLayout_tabIndicatorHeight cannot be resolved or is not a field
TabLayout_tabIndicatorColor cannot be resolved or is not a field
等。请提出建议。
将评论转化为您认为有用且能够解决您的问题的答案。
我不知道你为什么要在你的项目中手动 importing/copying 它,因为 TabLayout 是设计支持库的一部分,你只需要在你的 build.gradle 文件中包含它的工件 ID 即可访问其 类 和资源!
compile 'com.android.support:design:+' //replace + with latest version
我正在使用 TabLayout,但是在我的 src 中复制它之后,出现以下错误:
(1) android.support.v7.internal.widget.CompatTextView can not be resolved
(2) styleable cannot be resolved or is not a field
虽然我在 Whosebug 中检查了其他答案,但未能得到正确的解决方案。我已经导入 android.R
(3) 我检查了 android-support-v7-appcompat.jar 中缺少 class CompatTextView。这怎么可能。
(4)如果我复制google给的TabLayout class给我的app会不会有什么法律问题? 请帮忙。
- 更新:
我添加了
import android.support.v7.appcompat.R;
而不是android.R
并出现了一些错误,例如Widget_Design_TabLayout cannot be resolved or is not a field
TabLayout_tabIndicatorHeight cannot be resolved or is not a field
TabLayout_tabIndicatorColor cannot be resolved or is not a field
等。请提出建议。
将评论转化为您认为有用且能够解决您的问题的答案。
我不知道你为什么要在你的项目中手动 importing/copying 它,因为 TabLayout 是设计支持库的一部分,你只需要在你的 build.gradle 文件中包含它的工件 ID 即可访问其 类 和资源!
compile 'com.android.support:design:+' //replace + with latest version