Пустая белая полоса в макете без причины - PullRequest
0 голосов
/ 19 декабря 2018

У меня есть большая пустая белая полоса в нижней части моего макета, и я не знаю почему.Это действительно раздражает, и я действительно не люблю это: D Пожалуйста, помогите мне удалить это!

Blank bar Мой код макета:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ededed">

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

            <android.support.design.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                app:cardBackgroundColor="@android:color/white"
                app:cardCornerRadius="10dp"
                app:cardElevation="2dp"
                app:cardPreventCornerOverlap="true">

                <ImageView
                    android:id="@+id/image"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:background="@drawable/ic_menu_camera" />
            </android.support.design.card.MaterialCardView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/text_style_header"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/heading"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Heading...."
                    android:textAppearance="?attr/textAppearanceHeadline6"
                    android:textSize="20sp" />

                <TextView
                    android:id="@+id/description_short"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="2dp"
                    android:background="@drawable/text_style_desc"
                    android:text="Desc" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="12dp"
                    android:background="@drawable/text_style_desc"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/description"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginTop="2dp"
                        android:background="@drawable/text_style_desc"
                        android:text="text text text tex" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

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

РЕШЕНИЕ: Этот макет был из макета ViewPager, в котором было пустое место для добавления точек.Это была проблема.

Спасибо всем!

Ответы [ 2 ]

0 голосов
/ 19 декабря 2018

Задайте цвет фона для первого линейного макета вместо прокрутки.И добавьте fillViewport = true в scrollview

0 голосов
/ 19 декабря 2018

Попробуйте это

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ededed"
    android:fillViewport="true">

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

        <android.support.design.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            app:cardBackgroundColor="@android:color/white"
            app:cardCornerRadius="10dp"
            app:cardElevation="2dp"
            app:cardPreventCornerOverlap="true">

            <ImageView
                android:id="@+id/image"
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:background="@drawable/dishu" />

        </android.support.design.card.MaterialCardView>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_weight="1"
            android:background="@color/colorPrimary"
            android:orientation="vertical">

            <TextView
                android:id="@+id/heading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Heading...."
                android:textAppearance="?attr/textAppearanceHeadline6"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/description_short"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="2dp"
                android:background="@color/colorAccent"
                android:text="Desc" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="12dp"
                android:background="@color/colorPrimaryDark"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/description"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="2dp"
                    android:text="text text text tex" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</ScrollView>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...