Android Studio: линейное расположение не видно - PullRequest
0 голосов
/ 10 февраля 2019

В моем приложении линейный макет ниже относительного макета.Они содержатся в макете Constraint и Scrollview.

К сожалению, один из моих линейных макетов не появляется на моем экране.

Ниже приведен мой код, я вынул некоторые элементы, такие каккак TextViews, просто чтобы сделать его более понятным.

<?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=".ViewSingleClub">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="444dp"
        android:layout_marginTop="68dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:layout_editor_absoluteX="4dp"
            tools:layout_editor_absoluteY="68dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:background="@drawable/gradientsbackground"
                android:orientation="vertical"
                android:gravity="center"
                android:visibility="visible">

               //items inside here

            </LinearLayout>

            <android.support.v7.widget.CardView
                android:layout_width="270dp"
                android:layout_height="100dp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="100dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal"
                    android:weightSum="4">

                    //items inside here

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


//This layout and everything inside doesn't appear

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="45dp"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                //items inside here
            </LinearLayout>
        </LinearLayout>
    </ScrollView>

</android.support.constraint.ConstraintLayout>

Может ли кто-нибудь помочь мне понять, почему эта линейная схема не видна?

1 Ответ

0 голосов
/ 13 февраля 2019

Попробуйте, это исправит вашу проблему

<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">

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="444dp"
    android:layout_marginTop="68dp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:layout_editor_absoluteX="4dp"
            tools:layout_editor_absoluteY="68dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:background="@drawable/gradientsbackground"
                android:gravity="center"
                android:orientation="vertical"
                android:visibility="visible">

                //items inside here

            </LinearLayout>

            <android.support.v7.widget.CardView
                android:layout_width="270dp"
                android:layout_height="100dp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="100dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal"
                    android:weightSum="4">

                    //items inside here

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


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="45dp"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                //items inside here

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

</ScrollView>

...