как сделать прокрутку ScrollView под реальным RelativeLayout - PullRequest
0 голосов
/ 23 марта 2019

Нижний код представляет собой XML-макет Я пытаюсь сделать Scrollview to Scroll под RelativeLayout изображения и макет изображения все еще находится в этом положении, но все прокрутки макета, как я могу решить проблему?

 <?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout
 style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" 
    android:layout_width="match_parent"
   android:theme="@style/no_title"
  android:layout_height="match_parent"
  >
  <RelativeLayout
    android:id="@+id/real"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:fitsSystemWindows="true"
        android:orientation="vertical"
        tools:ignore="MissingPrefix"
        >
        <android.support.design.widget.AppBarLayout

            android:layout_width="match_parent"
            android:layout_height="170dp"
            android:fitsSystemWindows="true">

            <ImageView
                android:id="@+id/appbar"
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:scaleType="centerCrop"
                android:src="@drawable/person_ic" />

        </android.support.design.widget.AppBarLayout>
        <android.support.design.widget.FloatingActionButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:src="@android:drawable/ic_menu_camera"
            app:fabSize="mini"
            app:layout_anchor="@id/appbar"
            app:layout_anchorGravity="bottom|right|end" />
    </android.support.design.widget.CoordinatorLayout>
       </RelativeLayout>
       <ScrollView
        android:id="@+id/scroll_info"
          android:layout_width="match_parent"
         android:layout_height="match_parent"
        android:fillViewport="true" >
        <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="20dp"
        android:orientation="vertical">
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <android.support.design.widget.TextInputLayout
                android:id="@+id/USerNameLayout"  
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="240dp"
                android:textColorHint="#cccccc">
                <EditText
                    android:id="@+id/NameStudentRe"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:backgroundTint="#ffff"
                    android:clickable="true"
                    android:cursorVisible="false"
                    android:drawableLeft="@drawable/ic_person_black_24dp"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:hint="   Name"
                    android:inputType="textPersonName"
                    android:padding="3dp"
                    android:text=" Sukaina Ahmed Al-Mutawakel"
                    android:textColor="#cccccc"
                    android:textSize="20sp" />
            </android.support.design.widget.TextInputLayout>
        </RelativeLayout>
             </LinearLayout>
         </ScrollView>
</RelativeLayout>

1 Ответ

0 голосов
/ 24 марта 2019

этот код работает. Прокрутка textview под макетом изображения и макет не перемещаются.

<RelativeLayout 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=".MainActivity">


<RelativeLayout
    android:id="@+id/test_stackoverflow"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="500dp"
        android:background="@color/colorAccent"/>

</RelativeLayout>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/test_stackoverflow">

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

    </ScrollView>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...