gpt4 book ai didi

Android Material 设计错误膨胀类 android.support.design.widget.TextInputLayout

转载 作者:行者123 更新时间:2023-11-29 01:13:56 25 4
gpt4 key购买 nike

我是一个非常新的 android,所以我正在尝试为我的登录页面应用 Material 设计。我希望在 lolilop 之后和之前都支持它。当我尝试通过模拟器运行时出现此错误。

  Caused by: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class android.support.design.widget.TextInputLayout
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class android.support.design.widget.TextInputLayout
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)

这是我的 build.gradle。

构建 gradle。

android {
compileSdkVersion 24
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.ns.appversion1"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}

这是我的 styles.xml 设置。

样式.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

<style name="AppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>

<item name="android:windowBackground">@color/primary</item>

<item name="colorControlNormal">@color/iron</item>
<item name="colorControlActivated">@color/white</item>
<item name="colorControlHighlight">@color/white</item>
<item name="android:textColorHint">@color/iron</item>

<item name="colorButtonNormal">@color/primary_darker</item>
<item name="android:colorButtonNormal">@color/primary_darker</item>
</style>

<style name="AppTheme.Dark.Dialog" parent="Theme.AppCompat.Dialog">
<item name="colorAccent">@color/white</item>
<item name="android:textColorPrimary">@color/iron</item>
<item name="android:background">@color/primary</item>
</style>

</resources>

最佳答案

将其添加到您的依赖项中。

compile 'com.android.support:design:24.2.1'

下面的 Xml 是工作 TextInputLayout 的示例

<android.support.design.widget.TextInputLayout
android:id="@+id/testingInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AppCompat">

<EditText
android:id="@+id/testingEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/testText"
android:inputType="textEmailAddress" />

</android.support.design.widget.TextInputLayout>

关于Android Material 设计错误膨胀类 android.support.design.widget.TextInputLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41065296/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com