view - Hide Banner Space when there there are no Ads Android -


i changed admob sdk gps lib , there 1 thing bothering me. have simple view define line in layout prevent users clicking on ads unintentionally. admob sdk line drop bottom of layout when there no ads, gps lib, view remains is. enter image description here

and when there no ads, when user using app in offline mode there empty ugly space. enter image description here

how can rid of space when there no ads? here xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:ads="http://schemas.android.com/apk/res-auto"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:background="@drawable/back2" >     <relativelayout         android:id="@+id/upperbar"         android:layout_width="match_parent"         android:layout_height="48dp"         android:background="#000000" >         <relativelayout             android:id="@+id/relativelayout1"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_alignparentleft="true"             android:layout_alignparenttop="true"             android:background="@drawable/bar"             android:paddingbottom="2dp"             android:paddingleft="2dp"             android:paddingright="2dp"             android:paddingtop="2dp" >             <imagebutton                 android:id="@+id/infop"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="20dp"                 android:background="@drawable/info_select_blue" />             <imagebutton                 android:id="@+id/share"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_alignparenttop="true"                 android:layout_centerhorizontal="true"                 android:background="@drawable/share_selector_blue" />             <imagebutton                 android:id="@+id/moreaps"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_alignparentbottom="true"                 android:layout_alignparentright="true"                 android:layout_marginright="20dp"                 android:background="@drawable/more_selector_blue" />         </relativelayout>     </relativelayout>     <gridview         android:id="@+id/grid_view"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_above="@+id/view"         android:layout_below="@+id/sbsz"         android:columnwidth="110dp"         android:horizontalspacing="10dp"         android:listselector="#00000000"         android:numcolumns="auto_fit"         android:verticalspacing="12dp" >     </gridview>     <seekbar         android:id="@+id/sbsz"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentleft="true"         android:layout_below="@+id/upperbar"         android:progressdrawable="@drawable/apptheme_scrubber_progress_horizontal_holo_dark"         android:thumb="@drawable/apptheme_scrubber_control_selector_holo_dark" />     <com.google.android.gms.ads.adview         android:id="@+id/adview"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentleft="true"         ads:adsize="smart_banner"         ads:adunitid="@string/banner" >     </com.google.android.gms.ads.adview>     <view         android:id="@+id/view"         android:layout_width="fill_parent"         android:layout_height="17dp"         android:layout_above="@+id/adview"         android:layout_alignparentleft="true"         android:background="@drawable/bar"         android:visibility="visible" />  </relativelayout> 

you have check programatically there ad present or no.if ads not present set

adview.setvisibility(view.gone)  

else

adview.setvisibility(view.visible) 

thats it...


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -