ScrollViewが制約レイアウト内で機能しない

ファリド

ConstraintLayout内にスクロールビューがあります。しかし、ScrollviewがConstraintLayoutで機能しません。ScrollViewの代わりにNestedScrollViewを試しましたが、それでも機能しません。ScrollViewはLinearLayoutまたはRelativeLayoutで正常に機能しましたが、ConstraintLayoutでは機能しませんでした。android:layout_heightをmatch_parentとwrap_contentに変更しましたが、機能しませんでした。何が問題ですか?

<androidx.constraintlayout.widget.ConstraintLayout
    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"
    >

    <include
        android:id="@+id/other_toolbar_xml"
        layout="@layout/other_toolbar_xml"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintTop_toBottomOf="@id/other_toolbar_xml"
        android:fillViewport="true"
        tools:ignore="MissingConstraints"
        >

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >

            <ImageView
                android:id="@+id/img_content_xml"
                android:layout_width="match_parent"
                android:layout_height="170dp"
                app:layout_constraintTop_toBottomOf="@id/other_toolbar_xml"
                android:scaleType="fitXY"
                tools:ignore="NotSibling"
                />

            <TextView
                android:id="@+id/title_content_xml"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/img_content_xml"
                android:layout_marginRight="16dp"
                android:paddingLeft="16dp"
                android:textDirection="rtl"
                android:text="title"
                android:textSize="17sp"
                android:textColor="#1d1d1d"
                />

            <TextView
                android:id="@+id/content_content_xml"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/title_content_xml"
                android:layout_marginTop="20dp"
                android:layout_marginRight="16dp"
                android:layout_marginEnd="16dp"
                android:paddingLeft="16dp"
                android:textDirection="rtl"
                android:text="content"
                android:textColor="#1d1d1d"
                />

            <ImageView
                android:id="@+id/img_date_content_Xml"
                android:layout_width="18dp"
                android:layout_height="18dp"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/content_content_xml"
                android:layout_marginTop="20dp"
                android:layout_marginRight="16dp"
                android:layout_marginEnd="16dp"
                android:layout_marginBottom="16dp"
                android:src="@drawable/date"
                />

            <TextView
                android:id="@+id/date_content_xml"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintTop_toBottomOf="@id/content_content_xml"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintRight_toLeftOf="@id/img_date_content_Xml"
                android:layout_marginTop="20dp"
                android:layout_marginRight="8dp"
                android:layout_marginEnd="8dp"
                android:text="date"
                android:textColor="#1d1d1d"
                android:layout_marginBottom="16dp"
                />

            <TextView
                android:id="@+id/subject_content_xml"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintTop_toBottomOf="@id/content_content_xml"
                app:layout_constraintLeft_toLeftOf="parent"
                android:layout_marginTop="20dp"
                android:layout_marginStart="16dp"
                android:layout_marginLeft="16dp"
                android:singleLine="true"
                android:text="subject"
                android:textColor="#1d1d1d"
                />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
プラティックブタニ

タグに追加tools:ignore="MissingConstraints"したため、与える制約を見逃しまし<ScrollView

2つの方法があります:

  1. 親の制約レイアウト削除し、2つのレイアウトだけConstraintLayout必要としないため、RelativeLayoutを使用します。(これは主に、簡単にするために複雑なビューに使用されます)

  2. ConstraintLayoutを使用する場合は、適切な制約を与えます次のように、左、右、下の制約を見逃しました。

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:fillViewport="true"        
        app:layout_constraintTop_toBottomOf="@id/other_toolbar_xml"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" >
    
    //....
    
    </ScrollView>
    

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

自動レイアウト制約が機能しない

分類Dev

制約レイアウトの背景画像が機能しない

分類Dev

Travis CIビルドがAndroid制約レイアウトで機能しない

分類Dev

制約レイアウト制約寸法比が複数のビューで機能しない

分類Dev

ScrollViewがレイアウトで機能しない

分類Dev

データバインディングが制約レイアウトグループで機能しない

分類Dev

制約レイアウトがスクロール ビューで機能しない

分類Dev

Scrollviewが相対レイアウトだけで機能しない

分類Dev

制約レイアウトベータ4-フラグメントが機能しない

分類Dev

制約レイアウトベータ4-フラグメントが機能しない

分類Dev

Androidの制約レイアウトが意図したとおりに機能しない

分類Dev

自動レイアウトの制約が機能しないiPhone6および6Plus

分類Dev

パーセンテージが期待どおりに機能しない制約レイアウト

分類Dev

Androidの制約レイアウト1.1.3が機能しない場合のグループの可視性

分類Dev

Swift自動レイアウト:サブビューの制約が機能しない

分類Dev

制約レイアウトのスクロールバーが機能しない

分類Dev

制約レイアウト内のScrollview内のAndroid制約レイアウト

分類Dev

Android-別の制約レイアウトの背景内の制約レイアウトが表示されない

分類Dev

スタックビューと制約が機能しないことを使用して、プログラムでレイアウトを作成する

分類Dev

制約レイアウトが機能していません。レイアウトはデバイス間で破壊されます

分類Dev

レイアウトが制約を尊重しないのはなぜですか?

分類Dev

Androidの制約レイアウトが全画面で拡大しない

分類Dev

アプリでRTLレイアウトの方向が機能しないように強制する

分類Dev

OnTouchListenerが相対レイアウトで機能しない

分類Dev

ImageViewadjustViewBoundsが相対レイアウトで機能しない

分類Dev

centerVerticalがレイアウトで機能しない

分類Dev

JScrollPaneがnullレイアウトで機能しない

分類Dev

CollisionBehaviourが自動レイアウトで機能しない

分類Dev

xamarin自動レイアウトが機能していません-完全に制約されている間は制約を尊重しません

Related 関連記事

  1. 1

    自動レイアウト制約が機能しない

  2. 2

    制約レイアウトの背景画像が機能しない

  3. 3

    Travis CIビルドがAndroid制約レイアウトで機能しない

  4. 4

    制約レイアウト制約寸法比が複数のビューで機能しない

  5. 5

    ScrollViewがレイアウトで機能しない

  6. 6

    データバインディングが制約レイアウトグループで機能しない

  7. 7

    制約レイアウトがスクロール ビューで機能しない

  8. 8

    Scrollviewが相対レイアウトだけで機能しない

  9. 9

    制約レイアウトベータ4-フラグメントが機能しない

  10. 10

    制約レイアウトベータ4-フラグメントが機能しない

  11. 11

    Androidの制約レイアウトが意図したとおりに機能しない

  12. 12

    自動レイアウトの制約が機能しないiPhone6および6Plus

  13. 13

    パーセンテージが期待どおりに機能しない制約レイアウト

  14. 14

    Androidの制約レイアウト1.1.3が機能しない場合のグループの可視性

  15. 15

    Swift自動レイアウト:サブビューの制約が機能しない

  16. 16

    制約レイアウトのスクロールバーが機能しない

  17. 17

    制約レイアウト内のScrollview内のAndroid制約レイアウト

  18. 18

    Android-別の制約レイアウトの背景内の制約レイアウトが表示されない

  19. 19

    スタックビューと制約が機能しないことを使用して、プログラムでレイアウトを作成する

  20. 20

    制約レイアウトが機能していません。レイアウトはデバイス間で破壊されます

  21. 21

    レイアウトが制約を尊重しないのはなぜですか?

  22. 22

    Androidの制約レイアウトが全画面で拡大しない

  23. 23

    アプリでRTLレイアウトの方向が機能しないように強制する

  24. 24

    OnTouchListenerが相対レイアウトで機能しない

  25. 25

    ImageViewadjustViewBoundsが相対レイアウトで機能しない

  26. 26

    centerVerticalがレイアウトで機能しない

  27. 27

    JScrollPaneがnullレイアウトで機能しない

  28. 28

    CollisionBehaviourが自動レイアウトで機能しない

  29. 29

    xamarin自動レイアウトが機能していません-完全に制約されている間は制約を尊重しません

ホットタグ

アーカイブ