Дизайн макета ограничений для просмотра прокрутки для просмотра переработчика

#android

#Android

Вопрос:

 I need scroll view effect for the view inside scroll views and in the below code scroll view does not have any effect.I have connected card view to guide line and scroll view to guide line don't know because of fixed guild line scroll view is not working can any one help me in refactoring the xml with scroll view working?.
  

Я новичок в дизайне макета ограничений, поэтому меня не интересует дизайн макета вложенных ограничений. Итак, я взял только один ConstraintLayout в качестве родительского элемента, который необходимо улучшить с помощью этого.
Любая помощь приветствуется.

ниже приведен мой XML-код :

 
     <?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"
            android:background="@color/white">

            <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
                android:id="@ id/cardView"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginBottom="8dp"
                app:cardCornerRadius="10dp"
                app:cardElevation="5dp"
                app:layout_constraintBottom_toTopOf="@ id/guideline3"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                card_view:layout_constraintHorizontal_bias="1.0">

            </android.support.v7.widget.CardView>

            <android.support.constraint.Guideline
                android:id="@ id/guideline3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                app:layout_constraintGuide_percent="0.38030097" />

            <ImageView
                android:id="@ id/imageViewAccType"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="24dp"
                android:layout_marginTop="8dp"
                android:elevation="5dp"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toTopOf="@ id/cardView"
                app:srcCompat="@drawable/ic_icons_casa" />

            <TextView
                android:id="@ id/textView57"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="4dp"
                android:text=""
                android:elevation="5dp"
                android:textColor="@color/light_grey"
                android:textSize="14sp"
                app:layout_constraintBottom_toBottomOf="@ id/imageViewAccType"
                app:layout_constraintStart_toEndOf="@ id/imageViewAccType"
                app:layout_constraintTop_toTopOf="@ id/imageViewAccType" />

            <ImageView
                android:id="@ id/imageView20"
                android:layout_width="0dp"
                android:layout_height="0.5dp"
                android:layout_marginStart="32dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="32dp"
                android:scaleType="fitXY"
                android:elevation="5dp"
                android:tint="@color/colorPrimary"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@ id/textView68"
                app:srcCompat="@android:drawable/bottom_bar" />

            <TextView
                android:id="@ id/textView68"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:layout_marginTop="8dp"
                android:text=""
                android:elevation="5dp"
                android:textColor="@color/light_grey"
                android:textSize="14sp"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/imageView18" />

            <TextView
                android:id="@ id/textView69"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="32dp"
                android:text="checking.."
                android:textColor="@color/light_grey"
                android:textSize="16sp"
                android:elevation="5dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@ id/textView62"
                app:layout_constraintTop_toBottomOf="@ id/imageView18" />

            <TextView
                android:id="@ id/textView58"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:layout_marginTop="8dp"
                android:elevation="5dp"
                android:text=""
                android:textColor="@color/black"
                android:textSize="18sp"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/textView57" />

            <TextView
                android:id="@ id/textView59"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="32dp"
                android:elevation="5dp"
                android:text="Currency"
                android:textColor="@color/light_grey"
                android:textSize="14sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@ id/textView58"
                app:layout_constraintTop_toBottomOf="@ id/textView57" />

            <TextView
                android:id="@ id/textView60"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:elevation="5dp"
                android:text=""
                android:textColor="@color/light_grey"
                android:textSize="14sp"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/textView58" />

            <TextView
                android:id="@ id/textView61"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="32dp"
                android:elevation="5dp"
                android:text=""
                android:textColor="@color/black"
                android:textSize="16sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@ id/textView60"
                app:layout_constraintTop_toBottomOf="@ id/textView59" />

            <ImageView
                android:id="@ id/imageView15"
                android:layout_width="0dp"
                android:layout_height="0.5dp"
                android:layout_marginStart="32dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="32dp"
                android:elevation="5dp"
                android:scaleType="fitXY"
                android:tint="@color/colorPrimary"
                app:layout_constraintEnd_toEndOf="@ id/cardView"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/textView61"
                app:srcCompat="@android:drawable/bottom_bar" />

            <ImageView
                android:id="@ id/imageView18"
                android:layout_width="0dp"
                android:layout_height="0.5dp"
                android:layout_marginStart="32dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="32dp"
                android:elevation="5dp"
                android:scaleType="fitXY"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/textView62"
                app:srcCompat="@android:drawable/bottom_bar" />

            <TextView
                android:id="@ id/textView62"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:layout_marginTop="8dp"
                android:elevation="5dp"
                android:text=""
                android:textColor="@color/light_grey"
                app:layout_constraintStart_toStartOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/imageView15" />

            <TextView
                android:id="@ id/textView67"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="32dp"
                android:elevation="5dp"
                android:text="checking.."
                android:textColor="@color/black"
                android:textSize="20sp"
                android:textStyle="bold"
                app:layout_constraintEnd_toEndOf="@ id/cardView"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@ id/textView62"
                app:layout_constraintTop_toBottomOf="@ id/imageView15" />

            <TextView
                android:id="@ id/textView70"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="32dp"
                android:layout_marginBottom="16dp"
                android:elevation="5dp"
                android:gravity="center"
                android:text=""
                android:textColor="@android:color/holo_red_light"
                android:textSize="16sp"
                app:layout_constraintBottom_toBottomOf="@ id/cardView"
                app:layout_constraintEnd_toEndOf="@ id/cardView"
                app:layout_constraintTop_toBottomOf="@ id/imageView20" />

            <ScrollView
                android:id="@ id/scroll_view"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginBottom="8dp"
                app:layout_constraintBottom_toTopOf="@ id/bottom_bar"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="@ id/guideline3">

            </ScrollView>

            <TextView
                android:id="@ id/textView71"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:padding="10dp"
                android:text="RECENT BDA PAY TRANSACTIONS"
                android:textAllCaps="true"
                android:textColor="@color/colorAccent"
                android:textSize="14sp"
                android:textStyle="bold"
                app:layout_constraintStart_toStartOf="@ id/scroll_view"
                app:layout_constraintTop_toTopOf="@ id/guideline3" />

            <TextView
                android:id="@ id/textView72"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="22dp"
                android:padding="10dp"
                android:text="View All"
                android:textAllCaps="false"
                android:textColor="@color/colorPrimary"
                android:textSize="14sp"
                app:layout_constraintEnd_toEndOf="@ id/scroll_view"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@ id/textView71"
                app:layout_constraintTop_toTopOf="@ id/guideline3" />

            <android.support.v7.widget.RecyclerView
                android:id="@ id/recyclerView1"
                android:layout_width="0dp"
                android:layout_height="152dp"
                android:visibility="invisible"
                app:layout_constraintBottom_toTopOf="@ id/guideline14"
                app:layout_constraintEnd_toEndOf="@ id/scroll_view"
                app:layout_constraintStart_toStartOf="@ id/scroll_view"
                app:layout_constraintTop_toBottomOf="@ id/textView71" />

            <TextView
                android:id="@ id/textView14"
                android:layout_width="match_parent"
                android:layout_height="152dp"
                android:layout_gravity="center"
                android:gravity="center"
                android:text=""
                android:textAlignment="center"
                android:textColor="@color/light_grey"
                android:textSize="@dimen/size_16"
                android:visibility="invisible"
                app:layout_constraintBottom_toTopOf="@ id/textView74"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.51"
                app:layout_constraintStart_toStartOf="@ id/scroll_view"
                app:layout_constraintTop_toBottomOf="@ id/textView72"/>

            <android.support.constraint.Guideline
                android:id="@ id/guideline14"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                app:layout_constraintGuide_percent="0.6497948" />

            <TextView
                android:id="@ id/textView74"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:padding="10dp"
                android:text="RECENT BDA PAY REQUESTS"
                android:textAllCaps="true"
                android:textColor="@color/colorAccent"
                android:textSize="14sp"
                android:textStyle="bold"
                app:layout_constraintStart_toStartOf="@ id/scroll_view"
                app:layout_constraintTop_toTopOf="@ id/guideline14" />

            <TextView
                android:id="@ id/textView94"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="22dp"
                android:padding="10dp"
                android:text="View All"
                android:textAllCaps="false"
                android:textColor="@color/colorPrimary"
                android:textSize="14sp"
                app:layout_constraintEnd_toEndOf="@ id/scroll_view"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@ id/textView74"
                app:layout_constraintTop_toTopOf="@ id/guideline14" />

            <android.support.v7.widget.RecyclerView
                android:id="@ id/recyclerView2"
                android:layout_width="0dp"
                android:layout_height="152dp"
                android:layout_marginBottom="8dp"
                android:visibility="invisible"
                app:layout_constraintBottom_toTopOf="@ id/bottom_bar"
                app:layout_constraintEnd_toEndOf="@ id/scroll_view"
                app:layout_constraintStart_toStartOf="@ id/scroll_view"
                app:layout_constraintTop_toBottomOf="@ id/textView74" />

            <TextView
                android:id="@ id/textView15"
                android:layout_width="match_parent"
                android:layout_height="152dp"
                android:layout_gravity="center"
                android:gravity="center"
                android:text=""
                android:textAlignment="center"
                android:textColor="@color/light_grey"
                android:textSize="@dimen/size_16"
                android:visibility="invisible"
                app:layout_constraintEnd_toEndOf="@ id/scroll_view"
                app:layout_constraintHorizontal_bias="0.51"
                app:layout_constraintStart_toStartOf="@ id/scroll_view"
                app:layout_constraintTop_toBottomOf="@ id/textView74" />

            <include
                android:id="@ id/bottom_bar"
                layout="@layout/bottom_sheet_layout_new"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent" />

        </android.support.constraint.ConstraintLayout>

  

Я новичок в дизайне макета ограничений, поэтому меня не интересует дизайн макета вложенных ограничений. Итак, я взял только один ConstraintLayout в качестве родительского элемента, который необходимо улучшить с помощью этого.
Любая помощь приветствуется.

Комментарии:

1. любая помощь приветствуется!

2. используйте вложенный ScrollView

3. вложенный scrollview также не работает

4. мой doudt из-за горизонтальной направляющей линии scrollview не работает….

5. ScrollView должен содержать только один дочерний вид

Ответ №1:

ScrollView должен содержать только один дочерний вид

пример:

 <ScrollView>

<ConstarinLayout>
.
.
.
.
</ConstraintLayout>

</Scrollview>
  

Тогда только это работает..