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>
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.
If are looking for layout as below then the xml is as follows
Remove the TableLayout tags and put the attributes into the TableRow tags.
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.