2017-06-20 12 views
0

これは、ユーザーがツリー内で探しているもののさまざまなチェックボックスをチェックし、次にフィッティングツリーのリストが表示されるアプリの一部です。Scrollviewはスクロールしません

私は、画面の上部にあるedittextフィールドとボタンを使ってアクティビティを持っています。その下には、その中に単一のテキストビューを持つスクロールビュー(明らかに線形レイアウト内にあります)があります。ユーザーが前のアクティビティをチェックするさまざまなチェックボックスに基づいて、テキストビューのサイズが異なります。

問題は、テキストビューが非常に長いリストになるときです。リスト全体を表示するために画面を下にスクロールできません。私はリストの最上部にあるものだけを見ることができます。

<EditText 
    android:id="@+id/et_item" 
    android:layout_width="0dp" 
    android:layout_height="0dp" 
    android:layout_marginEnd="9dp" 
    android:layout_marginLeft="7dp" 
    android:layout_marginRight="9dp" 
    android:layout_marginStart="7dp" 
    android:ems="10" 
    android:hint="Item..." 
    android:inputType="textPersonName" 
    app:layout_constraintBottom_toBottomOf="@+id/scrollView2" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toLeftOf="@+id/button2" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:layout_constraintBottom_creator="1" 
    tools:layout_constraintLeft_creator="1" 
    tools:layout_constraintRight_creator="1" 
    tools:layout_constraintTop_creator="1" /> 

<Button 
    android:id="@+id/button2" 
    android:layout_width="88dp" 
    android:layout_height="48dp" 
    android:text="Find" 
    tools:layout_constraintTop_creator="1" 
    android:layout_marginStart="301dp" 
    tools:layout_constraintLeft_creator="1" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginLeft="301dp" 
    android:onClick="find" /> 

<TextView 
    android:id="@+id/tv1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="16dp" 
    android:layout_marginStart="16dp" 
    android:layout_marginTop="170dp" 
    android:textAppearance="@style/TextAppearance.AppCompat.Title" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:layout_constraintLeft_creator="1" 
    tools:layout_constraintTop_creator="1" /> 

<ScrollView 
    android:layout_width="0dp" 
    android:layout_height="0dp" 
    android:id="@+id/scrollView2" 
    app:layout_constraintRight_toLeftOf="@+id/linearLayout" 
    tools:layout_constraintTop_creator="1" 
    tools:layout_constraintRight_creator="1" 
    tools:layout_constraintBottom_creator="1" 
    app:layout_constraintBottom_toTopOf="@+id/linearLayout" 
    tools:layout_constraintLeft_creator="1" 
    app:layout_constraintLeft_toLeftOf="@+id/linearLayout" 
    app:layout_constraintTop_toTopOf="@+id/linearLayout"> 

</ScrollView> 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:layout_marginStart="8dp" 
    android:id="@+id/linearLayout" 
    tools:layout_constraintTop_creator="1" 
    android:layout_marginTop="43dp" 
    tools:layout_constraintLeft_creator="1" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginLeft="8dp"> 

    <TextView 
     android:id="@+id/tv_results" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="16dp" 
     android:layout_marginStart="16dp" 
     android:layout_marginTop="11dp" 
     android:text="Results..." 
     android:textAppearance="@style/TextAppearance.AppCompat.Title" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintTop_toTopOf="parent" 
     tools:layout_constraintLeft_creator="1" 
     tools:layout_constraintTop_creator="1" /> 

</LinearLayout> 

なぜ文句を言わないのスクロール作業:ここ

は、活動のための私のxmlのですか?

+3

ScrollViewは、空のようですか? –

+0

移動 thorin86

答えて

0

これはそれを修正する必要があります

<EditText 
    android:id="@+id/et_item" 
    android:layout_width="0dp" 
    android:layout_height="0dp" 
    android:layout_marginEnd="9dp" 
    android:layout_marginLeft="7dp" 
    android:layout_marginRight="9dp" 
    android:layout_marginStart="7dp" 
    android:ems="10" 
    android:hint="Item..." 
    android:inputType="textPersonName" 
    app:layout_constraintBottom_toBottomOf="@+id/scrollView2" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toLeftOf="@+id/button2" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:layout_constraintBottom_creator="1" 
    tools:layout_constraintLeft_creator="1" 
    tools:layout_constraintRight_creator="1" 
    tools:layout_constraintTop_creator="1" /> 

<Button 
    android:id="@+id/button2" 
    android:layout_width="88dp" 
    android:layout_height="48dp" 
    android:text="Find" 
    tools:layout_constraintTop_creator="1" 
    android:layout_marginStart="301dp" 
    tools:layout_constraintLeft_creator="1" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginLeft="301dp" 
    android:onClick="find" /> 

<TextView 
    android:id="@+id/tv1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="16dp" 
    android:layout_marginStart="16dp" 
    android:layout_marginTop="170dp" 
    android:textAppearance="@style/TextAppearance.AppCompat.Title" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:layout_constraintLeft_creator="1" 
    tools:layout_constraintTop_creator="1" /> 

<ScrollView 
    android:layout_width="0dp" 
    android:layout_height="0dp" 
    android:id="@+id/scrollView2" 
    app:layout_constraintRight_toLeftOf="@+id/linearLayout" 
    tools:layout_constraintTop_creator="1" 
    tools:layout_constraintRight_creator="1" 
    tools:layout_constraintBottom_creator="1" 
    app:layout_constraintBottom_toTopOf="@+id/linearLayout" 
    tools:layout_constraintLeft_creator="1" 
    app:layout_constraintLeft_toLeftOf="@+id/linearLayout" 
    app:layout_constraintTop_toTopOf="@+id/linearLayout"> 


<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:layout_marginStart="8dp" 
    android:id="@+id/linearLayout" 
    tools:layout_constraintTop_creator="1" 
    android:layout_marginTop="43dp" 
    tools:layout_constraintLeft_creator="1" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginLeft="8dp"> 

    <TextView 
     android:id="@+id/tv_results" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="16dp" 
     android:layout_marginStart="16dp" 
     android:layout_marginTop="11dp" 
     android:text="Results..." 
     android:textAppearance="@style/TextAppearance.AppCompat.Title" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintTop_toTopOf="parent" 
     tools:layout_constraintLeft_creator="1" 
     tools:layout_constraintTop_creator="1" /> 

</LinearLayout> 
</ScrollView> 
関連する問題