Currently I have following layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/editorRootView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout android:id="RL1"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<!-- LinearLayout needed so we have an border outside of the EditorView -->
<LinearLayout android:id="LL1"
android:background="@drawable/border"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<xenolupus.EditorView
android:id="@+id/editorView"
android:layout_width="300dip"
android:layout_height="216dip" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:orientation="horizontal" >
<Button
android:id="@+id/otherImage"
android:layout_width="150dip"
android:layout_height="60dip"
android:text="@string/cardEditor_OtherImageButtonText" />
<Button
android:id="@+id/next"
android:layout_width="150dip"
android:layout_height="60dip"
android:text="@string/cardEditor_NextButtonText" />
</LinearLayout>
</LinearLayout>
And the used @drawable/border:
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#FFFFFF" />
<stroke
android:width="10dip"
android:color="#FF0099CA" />
<padding
android:left="10dip"
android:top="10dip"
android:right="10dip"
android:bottom="10dip" />
<corners
android:radius="5dip" />
</shape>
However Eclipse warns me (yellow triangle with !) that the LinearLayout LL1 in the RelativeLayout RL1 is useless and should be removed:
This LinearLayout layout or its RelativeLayout parent is useless;
transfer the background attribute to the other view.
As the RelativeLayout is needed to center the EditorView I tried removing the LinearLayout LL1 and adding the android:background of the LinearLayout LL1 to the EditorView. However doing lets the border disappear behind the content of the EditorView.
Is there another way to add a border outside of the EditorView or should I just ignore the warning?
Greetings
Xeno Lupus
1 Answer