@BYMaz

Useless parent layout как устранить эту ошибку?

Столкнулся с такой проблемой появились 3 ошибки в файле activiti_main.xml Что нужно изменить?
Текст ошибок:
Ошибка№1 и 2
This LinearLayout layout or its RelativeLayout parent is possibly useless A layout with children that has no siblings, is not a scrollview or a root layout, and does not have a background, can be removed and have its children moved directly into the parent for a flatter and more efficient layout hierarchy. Issue id: UselessParent
Ошибка №3
This ScrollView layout or its LinearLayout parent is possibly useless A layout with children that has no siblings, is not a scrollview or a root layout, and does not have a background, can be removed and have its children moved directly into the parent for a flatter and more efficient layout hierarchy. Issue id: UselessParent
<?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"
    android:orientation="vertical"
    android:padding="10dp"
    tools:context=".MainActivity">

    <LinearLayout
        android:id="@+id/container1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/container2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="10dp">

            <ScrollView
                android:id="@+id/scroll"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

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

                    <TextView
                        android:id="@+id/textView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/Marhut2"
                        android:textAlignment="center"
                        android:textColor="#000000"
                        android:textColorHint="#777777"
                        android:textSize="18sp"
                        android:textStyle="bold" />
Это не весь код т.к он не уместился.
  • Вопрос задан
  • 547 просмотров
Решения вопроса 1
zagayevskiy
@zagayevskiy Куратор тега Android
Android developer at Yandex
Это предупреждение, по идее. Нужно удалить лишние лэйауты, нет смысла вкладывать их друг в друга, если других детей нет.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы