0

私はConstraint Layoutを持っており、その中にImageViewがあります。私は私のアプリをスクロールしたいいくつかのImageButtonのためのその下に私のXMLのリニアレイアウトを配置します。私は研究し、私が行ったScrollViewで私のリニアレイアウトをラップする必要があることがわかったが、何らかの理由で私のコンテンツの下部が表示されません。それは、エミュレータでビューの一番下を切り落とします。 フォーラムのいずれかで提案された相対レイアウトでScrollViewをラップしようとしましたが、何もしませんでした。私はまたアンドロイド:fillViewport = "true"でScrollViewを設定しようとしましたが、どちらもうまくいきませんでした。見た目のスクリーンショットを添付し、その下にXMLを貼り付けます。ScrollViewは完全なコンテンツを表示していませんか?

screenshot of app with content not showing at bottom

<?xml version="1.0" encoding="utf-8"?> 

<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.autismacademyed.www.autismacademy.AutismAcademy"> 


<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:layout_constraintHorizontal_bias="0.0" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    app:srcCompat="@drawable/logo" /> 


<ScrollView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="8dp" 
    android:layout_marginRight="8dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    android:layout_marginStart="8dp" 
    android:layout_marginEnd="8dp" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/imageView2"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="0dp" 
     android:layout_marginLeft="2dp" 
     android:layout_marginRight="2dp" 
     android:layout_marginTop="0dp" 
     android:orientation="vertical" 
     android:scrollIndicators="right|end" 
     android:scrollbars="vertical" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintHorizontal_bias="0.0" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/imageView2" 
     app:layout_constraintVertical_bias="0.0"> 

     <ImageButton 
      android:id="@+id/imageButtonRed" 
      android:layout_width="104dp" 
      android:layout_height="124dp" 
      android:layout_marginLeft="8dp" 
      android:layout_marginStart="8dp" 
      android:background="@null" 
      android:onClick="imageButtonOnClick" 
      android:scaleType="centerCrop" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/imageButtonYellow" 
      app:srcCompat="@drawable/ic_action_red" /> 

     <ImageButton 
      android:id="@+id/imageButtonBlue" 
      android:layout_width="125dp" 
      android:layout_height="110dp" 
      android:layout_marginTop="8dp" 
      android:background="@null" 
      android:scaleType="centerCrop" 
      app:layout_constraintTop_toBottomOf="@+id/imageButtonRed" 
      app:srcCompat="@drawable/ic_action_blue" 
      tools:layout_editor_absoluteX="0dp" /> 

     <ImageButton 
      android:id="@+id/imageButtonYellow" 
      android:layout_width="109dp" 
      android:layout_height="125dp" 
      android:layout_marginLeft="8dp" 
      android:layout_marginStart="8dp" 
      android:layout_marginTop="8dp" 
      android:background="@null" 
      android:onClick="imageButtonOnClick" 
      android:scaleType="centerCrop" 
      android:visibility="visible" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/imageView2" 
      app:srcCompat="@mipmap/ic_yellowpuzzlepiece" /> 

     <ImageButton 
      android:id="@+id/imageButtonGreen" 
      android:layout_width="109dp" 
      android:layout_height="125dp" 
      android:background="@null" 
      android:scaleType="centerCrop" 
      app:layout_constraintTop_toBottomOf="@+id/imageButtonYellow" 
      app:srcCompat="@drawable/ic_action_green" /> 


     <ImageButton 
      android:id="@+id/imageButtonBrown" 
      android:layout_width="109dp" 
      android:layout_height="125dp" 
      android:background="@null" 
      android:scaleType="centerCrop" 
      app:layout_constraintTop_toBottomOf="@+id/imageButtonYellow" 
      app:srcCompat="@drawable/ic_action_green" /> 

    </LinearLayout> 

</ScrollView> 

</android.support.constraint.ConstraintLayout> 
+0

私はまだプログラミングに新しいです@Selvinので、あなたが言ったことは私にはあまり意味がありません。より具体的なことができればお願いします。 – ZachGiovanelli

答えて

0

だから、このフォーラムのサイトで、私はこの質問を投稿することを決定したビデオチュートリアルをかなりの量の研究をしていました。私は他の人の時間を無駄にすることをお詫びしますが、私は左の関連する質問に気づいた!私は私のレイアウトに似たような記事を見つけたので、それを読んで自分の問題を解決する方法を理解しました!私はコードを使いこなし、XMLからLinear Layoutを削除し、別のConstraint Layoutに置き換えました。また、fillViewPortコードをScrollViewに追加し、Layout WidthとHeightを削除して0dpに変更しました。制約オプションを使用してScrollViewをエミュレータに適切にフィットさせ、ImageButtonが互いに重なり合うように同じことをしました。私は私を助けた記事をリンクします!

Bottom of ScrollView clipped when using ConstraintLayout

関連する問題