I'm learning how to develop Android application and am trying to add an image and a text centered on the screen if the ListView is empty. I've used the FrameLayout but it didn't work. I could use a margem Top, but this would cause a cut in the landscape mode. any idea?
Search (View.GONE)
Search (View.VISIBLE)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/searchLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/edtPesquisa"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:hint="@string/pesquisa_txt"
android:inputType="textPersonName"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/idLayoutActVirabrequins"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
android:id="@+id/idViewActVirabrequins"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:background="@drawable/ads"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id_act_virabrequins">
</com.google.android.gms.ads.AdView>
<ListView
android:id="@+id/lstVirabrequins"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerHeight="1dp"
android:longClickable="true"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ViewStub
android:id="@+id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout="@layout/empty" />
</LinearLayout>
</LinearLayout>
it is empty layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="centerInside"
android:alpha="0.7"
android:src="@drawable/empty"
android:contentDescription="@string/app_name" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textStyle="bold"
android:textColor="#757575"
android:alpha="0.7"
android:textSize="16sp"
android:fontFamily="sans-serif-light"
android:text="@string/empty" />
</LinearLayout>
thanks in advance!