【发布时间】:2015-08-17 08:45:19
【问题描述】:
我正在尝试在我的 XML 中使用 TextInputLayout,但遇到了这个错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.jechange.moncompte/fr.jechange.moncompte.SignUpActivity}: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.design.widget.TextInputLayout
[...]
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.design.widget.TextInputLayout
[...]
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/design/R$styleable;
我已经导入了设计库和support-v7-appcompat 库。我正在使用Theme.AppCompat.Light.NoActionBar 主题。
我在其中使用 文本输入布局 的 XML 包含类似的内容:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:res="http://schemas.android.com/apk/res-auto"
style="@style/matchParent">
<android.support.design.widget.TextInputLayout
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
【问题讨论】:
-
确保您的 lib 文件夹中有 v7 jar 文件。
-
我试过但没有。但是目前,我将我的项目与 support-v7-appcompat 库相关联,所以我不需要添加 v7 jar 吗? (我一直对库、jar 等有疑问)
-
当我们链接一个 lib 时,它会自动添加到 lib 目录中,但有时它不会。所以我们必须手动完成。
-
好的,所以在我的情况下,v7 jar 没有添加到我的项目中。但是我手动添加了它,并没有解决我的问题:/
-
您使用的是哪个 IDE?
标签: android android-design-library