为了账号安全,请及时绑定邮箱和手机立即绑定

Android 在空 EText 上崩溃

Android 在空 EText 上崩溃

温温酱 2021-09-03 16:36:54
只要编辑文本为空,应用程序就会不断崩溃。当我输入电子邮件时,它工作正常。我不知道我做错了什么,我已经尝试更改高度值,在它为空时手动检查,但问题仍然存在。任何人都可以让我知道代码是否有问题。XML:<android.support.design.widget.CoordinatorLayout    android:layout_width="match_parent"    android:layout_height="match_parent"    android:focusableInTouchMode="true">    <android.support.design.widget.AppBarLayout        android:id="@+id/appBarLayout"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:fitsSystemWindows="true"        android:theme="@style/ThemeOverlay.AppCompat.ActionBar">        <android.support.design.widget.CollapsingToolbarLayout            android:id="@+id/collapsingToolbarLayout"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:fitsSystemWindows="true"            android:background="@color/colorBlackary"            app:contentScrim="?attr/colorPrimary"            app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"            app:titleEnabled="false">            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_gravity="center"                android:layout_marginTop="5dp"                android:padding="10dp"                android:text="@string/title_forgot_password"                android:textColor="@color/colorRed"                android:textSize="15sp" />            <android.support.v7.widget.Toolbar                android:id="@+id/toolbar"                android:layout_width="match_parent"                android:layout_height="match_parent"                app:layout_collapseMode="pin"                app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />        </android.support.design.widget.CollapsingToolbarLayout>    </android.support.design.widget.AppBarLayout>
查看完整描述

2 回答

?
隔江千里

TA贡献1906条经验 获得超10个赞

我发现了问题:

android:theme="@style/TextLabel"

必须先创建一个主题,然后再创建一个样式,然后像这样使用它:

    <style name="TextLabel" parent="BellicTheme">

谢谢大家


查看完整回答
反对 回复 2021-09-03
  • 2 回答
  • 0 关注
  • 150 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信