0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Fragment+RecyclerView+EditTextでホワイトスクリーン

Posted at

RecyclerViewの中にEditTextを入れて、カーソルをあてると、画面が真っ白になる。
けど、1文字入力すると、画面が表示されるが、キーボードを下げるボタンをクリックするとやはり、画面が白くなる。

キーボード下げるボタン

スクリーンショット 2019-12-21 13.22.34.png

原因

ConstraintLayoutで全体を括っているのですよね。これがアカンかった。

問題の事象が発生するLayout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.core.widget.NestedScrollView
        android:id="@+id/nestedScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:overScrollMode="never"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:id="@+id/linearLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:text="タイトル"
            android:textAlignment="center"
            android:textSize="20sp" />

        <Button
            android:id="@+id/submit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_gravity="center"
            android:text="送信" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/trip_list"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="36dp"
            android:layout_marginEnd="36dp"
            android:layout_marginTop="16dp"
            android:layout_gravity="top"/>

        </LinearLayout>>
    </androidx.core.widget.NestedScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
問題の事象が発生しないLayout
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:overScrollMode="never"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:text="タイトル"
            android:textAlignment="center"
            android:textSize="20sp" />

        <Button
            android:id="@+id/submit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_gravity="center"
            android:text="送信" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/trip_list"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="36dp"
            android:layout_marginEnd="36dp"
            android:layout_marginTop="16dp"
            android:layout_gravity="top"/>

    </LinearLayout>
</androidx.core.widget.NestedScrollView>

エラーログとか出ないし、fragmentの組み方(Java)が悪いのか?とか諸々調べて、めっちゃ時間かかった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?