简体   繁体   English

使用Eclipse,layout.xml文件上的TabLayout错误

[英]Using Eclipse, TabLayout error on layout.xml file

http://developer.android.com/tools/support-library/setup.html http://developer.android.com/tools/support-library/setup.html

As it is shown there, I have imported the android-support-design.jar and android-support-v7-appcompat.jar libraries without source. 如此处所示,我已经导入了android-support-design.jar和android-support-v7-appcompat.jar库,没有源代码。 Although including android.support.v7.widget.Toolbar into layout.xml file does not make any error, including android.support.design.widget.TabLayout makes an error as like: 尽管将android.support.v7.widget.Toolbar包含到layout.xml文件中不会产生任何错误,但包括android.support.design.widget.TabLayout会产生如下错误:

The following classes could not be instantiated: - android.support.design.widget.TabLayout 无法实例化以下类:-android.support.design.widget.TabLayout

However, I can declare TabLayout object into the MainActivity. 但是,我可以将TabLayout对象声明为MainActivity。 The MainActivity accepts the design library, but layout.xml file does not. MainActivity接受设计库,但layout.xml文件不接受。 How can I fix it? 我该如何解决? Thank you. 谢谢。

Try clean > Build project 尝试clean > Build project

or restarting Eclipse problably you have cache issue. 或可能重新启动Eclipse时出现缓存问题。

Thank you guys for your advices. 谢谢你们的建议。 I decided to re-install SDK and moved into Android Studio. 我决定重新安装SDK,并转移到Android Studio中。 Despite of a little bit slowness compered to Eclipse, everything works properly. 尽管Eclipse有点慢,但一切正常。 Sorry for those who searched the same error and found this unsolved question. 对那些搜索相同错误并找到未解决的问题的人表示抱歉。 I recommend the same way that I have followed. 我建议遵循相同的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM