Представление прокрутки продолжает отбрасывать нижнее представление от отображения - PullRequest
0 голосов
/ 11 января 2019

Я создал пользовательский интерфейс предпочтений, но дело в том, что я не могу позволить отображать на устройстве самый нижний дочерний вид. Он продолжает отбрасывать самый нижний вид. Хотя этот запрос похож на тот, который я нашел в списке запросов, проблема, с которой я столкнулся, не позволила мне отладки, или я упустил какое-то серьезное свойство. Мой код: Дно TextView, которое я окончательно обернул в относительном виде, это часть, которая отбрасывается. Интересно, я перешел на LinearLayout с Относительного встроенного, я думаю, у него тоже могут быть проблемы ... Но самый важный запрос заключается в том, что он не прокручивается до конца действия.

<?xml version="1.0" encoding="utf-8"?>
<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=".Preferences">

   <RelativeLayout
       android:layout_width="match_parent"
       android:layout_height="60dp"
       android:background="@color/colorPrimary"
       android:id="@+id/header"
enter code here
       >
       <ImageView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/back_key"
           />
       <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/text_prefer"
           android:layout_centerInParent="true"
           android:layout_centerVertical="true"
           android:text="@string/activity_name"
           android:textColor="@color/white"
           android:textStyle="bold"
           android:textSize="18sp"
           />

   </RelativeLayout>
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/wrapper_scroll"
        android:layout_below="@id/header"
        >
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/scroll_horizontal"
            android:fillViewport="true"
            >
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:layout_marginLeft="11dp"
                android:layout_marginRight="11dp"
                android:id="@+id/rel_scroll"
                android:layout_marginBottom="10dp"
                >
                <RelativeLayout

                    android:layout_width="match_parent"
                    android:layout_height="120dp"
                    android:background="@drawable/rounded_back_for_layout"
                    android:id="@+id/rel_age_layout"
                    android:layout_marginBottom="5dp"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="18dp"
                        android:id="@+id/age_text"
                        android:text="@string/age"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:textColor="@color/magenta_brown"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="18dp"
                        android:layout_alignParentRight="true"
                        android:text="18-26"
                        android:textStyle="bold"
                        android:textSize="14sp"
                        android:textColor="@color/black"

                        />

                </RelativeLayout>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/text_age_pref"
                    android:layout_below="@id/rel_age_layout"
                    android:text="@string/age_prefer"
                    android:textSize="10.5sp"
                    android:layout_marginLeft="3dp"
                    android:layout_marginRight="3dp"
                    />
                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="45dp"
                    android:layout_below="@id/rel_age_layout"
                    android:background="@drawable/rounded_back_for_layout"
                    android:id="@+id/rel_interest_layout"
                    android:layout_marginBottom="5dp"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="16dp"
                        android:id="@+id/interested_in_text"
                        android:text="@string/interested_in"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:textColor="@color/magenta_brown"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="18dp"
                        android:layout_below="@id/interested_in_text"
                        android:text="@string/men"
                        android:textSize="14sp"
                        android:textColor="@color/black"
                        android:id="@+id/men"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="18dp"
                        android:layout_below="@id/men"
                        android:layout_marginTop="10dp"
                        android:text="@string/women"
                        android:textSize="14sp"
                        android:textColor="@color/black"
                        android:layout_marginBottom="10dp"
                        />
                </RelativeLayout>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/interested_pref"
                    android:layout_below="@id/rel_interest_layout"
                    android:text="@string/interested_prefer"
                    android:textSize="10.5sp"
                    android:layout_marginLeft="3dp"
                    android:layout_marginRight="3dp"
                    />

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="38dp"
                    android:layout_below="@id/rel_interest_layout"
                    android:background="@drawable/rounded_back_for_layout"
                    android:id="@+id/rel_alerts_layout"
                    android:layout_marginBottom="5dp"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="18dp"
                        android:id="@+id/alerts_mode"
                        android:text="@string/alerts"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:textColor="@color/magenta_brown"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="18dp"
                        android:layout_below="@id/alerts_mode"
                        android:text="@string/sound"
                        android:textSize="14sp"
                        android:layout_marginBottom="14dp"
                        android:textColor="@color/black"
                        />
                </RelativeLayout>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/sound_prefer"
                    android:layout_below="@id/rel_alerts_layout"
                    android:textSize="10.5sp"
                    android:layout_marginLeft="3dp"
                    android:layout_marginRight="3dp"
                    />
                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="45dp"
                    android:layout_marginBottom="5dp"
                    android:layout_below="@id/rel_alerts_layout"
                    android:background="@drawable/rounded_back_for_layout"
                    android:id="@+id/rel_matchmaker_layout"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="18dp"
                        android:id="@+id/matchmaker_text"
                        android:text="@string/matchmaker"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:textColor="@color/magenta_brown"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        android:layout_marginLeft="18dp"
                        android:layout_below="@id/matchmaker_text"
                        android:text="@string/hide_my_prof"
                        android:textSize="14sp"
                        android:textColor="@color/black"
                        android:layout_marginBottom="10dp"

                        />
                </RelativeLayout>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/matchmaker_prefer"
                    android:text="@string/matchmaker_prefer"
                    android:layout_below="@id/rel_matchmaker_layout"
                    android:textSize="12sp"

                    />
                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="38dp"
                    android:layout_below="@id/rel_matchmaker_layout"
                    android:background="@drawable/rounded_back_for_layout"
                    android:id="@+id/rel_whitelist_layout"
                    android:layout_marginBottom="10dp"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="18dp"
                        android:id="@+id/whitelist_text"
                        android:text="@string/whitelist"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:textColor="@color/magenta_brown"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="18dp"
                        android:layout_alignParentRight="true"
                        android:text="@string/go"
                        android:padding="10dp"
                        android:background="@drawable/edittext_rectangle_border"
                        android:textStyle="bold"
                        android:textSize="14sp"
                        android:textColor="@color/black"
                        />
                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/rel_whitelist_layout"
                    >
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="10.5sp"
                        android:layout_marginLeft="3dp"
                        android:layout_marginRight="3dp"
                        android:text="@string/whitelist_prefer"
                        />
                </RelativeLayout>
            </LinearLayout>

        </ScrollView>

    </RelativeLayout>

    </RelativeLayout>

Вот скриншот:

image

Ответы [ 2 ]

0 голосов
/ 11 января 2019

Я попробовал ваш xml, и это сработало.
Добавьте это к вашему последнему TextView

android:layout_margin="18dp"   

Ваш последний элемент будет:

  <RelativeLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@id/rel_whitelist_layout">
          <TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="10.5sp"
              android:layout_marginLeft="3dp"
              android:layout_marginRight="3dp"
              android:layout_margin="18dp"  
              android:text="@string/whitelist_prefer"/>
  </RelativeLayout>
0 голосов
/ 11 января 2019

Попробуйте изменить высоту ScrollView с match_parent на wrap_content:

<ScrollView
...
    android:layout_height="wrap_content"
... >
...