我有一个活动,其中edittext在那里,当我点击edittext打开键盘时,应用程序崩溃并重新启动为什么?

时间:2018-04-06 07:42:18

标签: java android android-layout android-edittext

我的活动课没有写任何东西。

public class LoginActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
    }
}

activity_login.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="#ffff">
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="65dp"
        android:orientation="horizontal"
        android:background="@drawable/ic_comment_text_background"
        android:layout_alignParentBottom="true"
        android:id="@+id/numberlayout">


        <EditText
            android:id="@+id/phone_verify"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical"
            android:layout_marginBottom="5dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            android:background="#fff"
            android:hint="Enter Number"
            android:inputType="phone"
            android:maxLength="10"
            android:textCursorDrawable="@null"
            android:textSize="20sp">
        </EditText>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:paddingEnd="8dp"
            android:layout_gravity="center_vertical"
            android:gravity="right">

            <Button
                android:layout_gravity="center"
                android:id="@+id/next_verify"
                android:layout_width="90dp"
                android:layout_height="35dp"
                android:text="Next"
                android:fontFamily="sans-serif-condensed"
                android:gravity="center"
                android:textColor="#fff"
                android:background="@drawable/ic_button_color_grey">
                <requestFocus/>
            </Button>

        </LinearLayout>
    </LinearLayout>
</RelativeLayout>

的Manifest.xml

<activity android:name=".ui.activity.LoginActivity"
            android:windowSoftInputMode="stateHidden|adjustResize"
            />

我尝试进行登录活动,以便任何人都可以使用手机号码登录,但是当我点击编辑文本打开键盘应用程序时会崩溃。为什么? 任何人都可以帮助解决问题。 我测试的手机是Sony Xperia m2,它的内存是1 GB。

单击编辑文本时,下面是logcat。 任何帮助将不胜感激。

logcat的

java.lang.StackOverflowError: stack size 8MB
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)

04-06 15:11:53.452 13289-13289/com.test.app E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!
04-06 15:11:53.462 13289-13289/com.test.app E/AndroidRuntime: Error reporting crash
    android.os.TransactionTooLargeException
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(Binder.java:496)
        at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:4175)
        at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:89)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

2 个答案:

答案 0 :(得分:0)

我没有你的drawable当然是你的xml文件。所以你的问题可能来自你的drawable,所以检查它们的大小,太大的大小可能会使你的应用程序崩溃,如果你的手机小于24 API,你也可能有API错误,如果你的drawable在drawable-24文件夹中,但我不要以为这是问题所在。如果问题不在上面,那么您的手机可能是导致车祸的原因,如果可以,请与另一部手机联系。

答案 1 :(得分:0)

终于得到了解决方案。我刚创建并将release.apk安装到它为我工作的手机上。 但有人能说出debug.apk导致我的应用崩溃的原因是什么?