我正在开发一个Android应用程序。如果我使用上面的lolipop运行应用程序,它工作正常。但是,如果我试图在果冻豆中运行它的InflateException: Binary XML file line #0: Error inflating class android.support.design.widget.TextInputLayout
致命的例外:主要 流程:hirerate.softweb.com.hirerate,PID:1542 android.view.InflateException:二进制XML文件行#0:错误膨胀类android.support.design.widget.TextInputLayout 在android.view.LayoutInflater.createView(LayoutInflater.java:620) 在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 在android.view.LayoutInflater.inflate(LayoutInflater.java:492) 在android.view.LayoutInflater.inflate(LayoutInflater.java:397) at hirerate.softweb.com.hirerate.Fragment.BuyerSignupFragment.onCreateView(BuyerSignupFragment.java:81) 在android.support.v4.app.Fragment.performCreateView(Fragment.java:2261) 在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419) 在android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750) 在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819) 在android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797) 在android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590) 在android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377) 在android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332) 在android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2209) 在android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:649) 在android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145) 在android.support.v4.view.ViewPager.populate(ViewPager.java:1238) 在android.support.v4.view.ViewPager.populate(ViewPager.java:1086) 在android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1616) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:742) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:607) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:742) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:607) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:340) 在android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:742) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:607) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:340) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:742) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:607) 在android.view.View.measure(View.java:16961) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5376) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:340) 在com.android.internal.policy.impl.PhoneWindow $ DecorView.onMeasure(PhoneWindow.java:2347) 在android.view。
的build.gradle
android {
compileSdkVersion 27
defaultConfig {
applicationId ""
minSdkVersion 17
targetSdkVersion 27
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(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:cardview-v7:27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:recyclerview-v7:27.0.1'
}
layout.xml
<android.support.design.widget.TextInputLayout
app:hintTextAppearance="@android:style/TextAppearance.Medium"
android:theme="@style/TextLabel"
android:id="@+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padd_10">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:typeface="serif"
android:maxLines="1"
android:textSize="@dimen/texthead"
android:maxLength="30"
android:drawableTint="@color/lavendar"
android:drawableStart="@mipmap/ic_mail"
android:drawablePadding="20dp"
android:drawableLeft="@mipmap/ic_mail"
android:hint="@string/email" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
app:hintTextAppearance="@android:style/TextAppearance.Medium"
android:theme="@style/TextLabel"
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled = "true"
app:passwordToggleTint="@color/liggrey"
app:counterEnabled="true"
app:passwordToggleDrawable="@drawable/asl_password_visibility"
android:layout_marginTop="@dimen/padd_10">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:typeface="serif"
android:maxLines="1"
android:textSize="@dimen/texthead"
android:maxLength="20"
android:drawableTint="@color/lavendar"
android:drawableStart="@mipmap/ic_key"
android:drawablePadding="20dp"
android:drawableLeft="@mipmap/ic_key"
android:hint="@string/password" />
</android.support.design.widget.TextInputLayout>
style.xml
<style name="TextLabel" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColor">#3A3A80</item>
<item name="colorControlHighlight">#3A3A80</item>
<item name="colorControlNormal">@color/secondary_text</item>
<item name="colorControlActivated">@android:color/black</item>
<item name="android:textColorHint">@color/secondary_text</item>
</style>
答案 0 :(得分:0)
删除android:drawableTint="@color/lavendar
“和android:drawableLeft="@mipmap/ic_mail"
他们分别需要min api level 23和26