Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This TableLayout layout or its LinearLayout parent is useless how to resolve from this warning

Tags:

android

layout

I have tablelayout inside linearlayout but it shows me this warning message
This TableLayout layout or its LinearLayout parent is useless how to overcome from this warning can ane help me . Thanks in advance

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

          <TableLayout>

            <TableRow
                android:id="@+id/tableRow3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center" >

                <TextView
                    android:id="@+id/txtPass"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|center_horizontal"
                    android:text="Password"
                    android:textSize="18sp"
                    android:width="100dp" />

                <EditText
                    android:id="@+id/edPass"
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:inputType="textPassword"
                    android:password="true" >

                    <requestFocus />
                </EditText>
              </TableRow>
          </TableLayout>

      </LinearLayout>
like image 818
Sachin Gurnani Avatar asked Oct 27 '25 23:10

Sachin Gurnani


2 Answers

Why do you need top most LinearLayout when you dont have anything inside LinearLayout except TableLayout? One of these layout should be enough. Remove either LinearLayout (or) TableLayout. That should resolve the issue.

like image 60
kosa Avatar answered Oct 30 '25 12:10

kosa


Through the warning, the system just wants to say you have the space to optimize your layout code.There is no need to care much about it if you do not want to optimize your code now.

like image 27
EisenMurphy Avatar answered Oct 30 '25 14:10

EisenMurphy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!