猿问

Android 在空 EText 上崩溃

只要编辑文本为空,应用程序就会不断崩溃。当我输入电子邮件时,它工作正常。我不知道我做错了什么,我已经尝试更改高度值,在它为空时手动检查,但问题仍然存在。任何人都可以让我知道代码是否有问题。

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>



温温酱
浏览 151回答 2
2回答

隔江千里

我发现了问题:android:theme="@style/TextLabel"必须先创建一个主题,然后再创建一个样式,然后像这样使用它:&nbsp;&nbsp;&nbsp;&nbsp;<style&nbsp;name="TextLabel"&nbsp;parent="BellicTheme">谢谢大家
随时随地看视频慕课网APP

相关分类

Java
我要回答