Am new to android development. I had created one android app and for that following is my main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/grid_layout_1"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<Button android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login_btn_text"/>
<Button android:id="@+id/btnRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reg_btn_text"/>
</LinearLayout>
</RelativeLayout>
Am getting the following warning :
This LinearLayout layout or its RelativeLayout parent is possibly useless;
transfer the background attribute to the other view
Can anyone tell the reason for this warning and a solution to the issue.?
There is no real usage to have just a LinearLayout inside a RelativeLayout. So one of them is useless as this is redundant.
edit
This warning is triggered, when a Layout has only one child that is also a Layout. In this case one of both can be removed without any problems. It is recommended to remove these redundant layouts as they reduce the overall performance of the UI.