在尝试使用新的安卓TextInputField
时发生了崩溃,并想分享我的解决方案。
在android appcompat库中尝试新的TextInputField时,我的应用程序崩溃了。这是我的布局xml。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="e-mail"
android:inputType="textEmailAddress"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
我得到的错误是:
android.view.InflateException: Binary XML file line #20: Error inflating class android.support.design.widget.TextInputLayout.
解决方案:将hintTextAppearance
属性添加到您的TextInputLayout
中,使lead标记如下所示:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@android:style/TextAppearance.Medium">
https://stackoverflow.com/questions/30578976
复制相似问题