I have a ListActivity
whose layout looks like
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@android:id/list" android:cacheColorHint="@color/transparent" style="@style/FullWidth.NoteList" />
<LinearLayout android:id="@android:id/empty" style="@style/FillParent">
<ImageView style="@style/NoNotesImage" />
<TextView android:text="@string/no_notes" style="@style/Shadowed.NoNotesText" />
<Button android:id="@+id/note_add" android:text="@string/note_add" style="@style/Shadowed.Button.Blue"/>
</LinearLayout>
</LinearLayout>
The styles relevant here.
<?xml version="1.0" encoding="utf-8"?>
<style name="Shadowed">
<item name="android:shadowDx">1.1</item>
<item name="android:shadowDy">1.1</item>
<item name="android:shadowRadius">1.1</item>
</style>
<style name="NoNotesImage">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center</item>
<item name="android:layout_marginTop">80.5dip</item>
<item name="android:layout_marginLeft">20dip</item>
<item name="android:src">@drawable/bg_no_notes</item>
</style>
<style name="Shadowed.NoNotesText">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center</item>
<item name="android:textSize">10sp</item>
<item name="android:textColor">@color/no_notes_text</item>
<item name="android:shadowColor">@color/no_notes_shadow</item>
</style>
<style name="FillParent">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
</style>
However, my empty list view consist only of the ImageView
listed first inside the nested LinearLayout
.
This seems like a reasonable thing to do but I don't completely understand Android's layout rules yet.