B
B
Bravis20182018-04-10 14:54:17
Java
Bravis2018, 2018-04-10 14:54:17

How to remove overlapping elements on top of each other in Android?

There is a three-element layout. The first element is an image, the second element is a custom GridView that sits below the first element. And the third element, which is always located at the bottom of the screen. When the screen flips and the gridView reaches the end, it sticks together with the text. How to fix so that there is always a minimum distance between GridView and TextView, for example 8dp.

Screenshots

Горизонтальное расположение
5acca4cfadb75191990175.jpeg
Вертикальное расположение
5acca4e24ff18303976493.jpeg
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:layout_width="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/logo"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="8dp"
            android:src="@drawable/placeholder" />

         <com.example.project.customViews.ExpandableHeightGridView
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/gridViewNavigator"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:isScrollContainer="false"
                android:layout_below="@+id/logo"
                android:gravity="center"
                android:numColumns="3" />

        <TextView
            android:id="@+id/txtWarning"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/gridViewNavigator"
            android:layout_alignParentBottom="true"
            android:text="Приложение является демонстрационным"
            android:textAlignment="center" />
    </RelativeLayout>
</ScrollView>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question