I want to place an ad banner at the bottom of the screen. I wrote the following code, which has one error when whenever the contents of the list are too large, when the ad overrides the content, and the last element of the list is never displayed. How can I code so that whenever the ads are not visible (for any reason), the listview should occupy the entire screen, and whenever the ads are visible, they should not override the last element of the list.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rlLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_img"
tools:context="${packageName}.${activityClass}" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<ListView
android:id="@+id/rhymesList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:dividerHeight="0dp" >
</ListView>
</LinearLayout>
<com.startapp.android.publish.banner.Banner
android:id="@+id/startAppBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
source
share