开发者

Problem in adding admob ads in layout

开发者 https://www.devze.com 2023-04-09 04:26 出处:网络
I have Admob ads Network in my app..I placed this ads Network in my relative layout..In these relative layout i have buttons..so at the bottom of the layout i put my addNetwork to display ads.Now the

I have Admob ads Network in my app..I placed this ads Network in my relative layout..In these relative layout i have buttons..so at the bottom of the layout i put my addNetwork to display ads.Now the problem is that onClick of my button i open an dialog..In these dialog i have EditText so when i click on edit text an input keyboard is open and here the problem arise.. As soon as the input keyboard arises the layout become shrink and when the cancel the keyboard again the layout become resize..but when i remove my adsNetwork layout from that relative layout and agin do the same process than the layout doesnt shring..why these happen can anyone please suggest me..i have send my xml layout..

<?xml version="1.0" encoding="UTF-8"?>

<LinearLayout android:layout_marginTop="20dp" android:id="@+id/linearLayout" android:orientation="horizontal" 
    android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:background="#00000000"
    android:gravity="center_horizontal|center_vertical" android:layout_height="wrap_content" android:layout_width="fill_parent">

    <Button android:id="@+id/btn_prev_month"
        android:textColor="#000000"
        android:layout_width="53dp" 
        android:layout_height="40dp"
        android:gravity="center_horizontal|center_vertical"
        android:background="@drawable/prev_btn_bg_selector">
    </Button>

    <TextView android:id="@+id/txt_month"                                 
        android:textSize="18dp"
        android:textColor="#000000" 
        android:layout_width="50dp" 
        android:layout_height="wrap_content"            
        android:layout_toRightOf="@+id/btn_Prev_month"
        android:gravity="center_horizontal|center_vertical">
    </TextView>

    <TextView android:id="@+id/txt_year"
        android:textSize="18dp" 
        android:textColor="#000000"                
        android:layout_width="50dp" 
        android:layout_marginRight="5dp"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/txt_month"
        android:gravity="center_horizontal|center_vertical">
    </TextView>

    <Button android:id="@+id/btn_next_month" 
        android:textColor="#000000"
        android:layout_width="53dp" 
        android:layout_height="40dp"
        android:layout_toRightOf="@+id/txt_year"            
        android:gravity="center_horizontal|center_vertical"
        android:background="@drawable/next_btn_bg_selector">
    </Button>
</LinearLayout>                      

<ViewFlipper android:id="@+id/flipview" android:layout_below="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_marginTop="15dp">  
    <LinearLayout android:id="@+id/liVLayout" android:orientation="vertical" android:layout_width="fill_parent"             
        android:layout_height="wrap_content">                                                                 
    </LinearLayout>    
</ViewF开发者_Go百科lipper>          

<LinearLayout android:id="@+id/linearLayout1" android:orientation="vertical" android:layout_marginLeft="7dp" 
      android:layout_marginRight="7dp" android:layout_below="@+id/flipview" android:layout_height="wrap_content" 
      android:layout_width="fill_parent" android:background="#00000000">

      <TextView android:id="@+id/txt_status"                                   
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:layout_marginTop="10dp" 
        android:textColor="#000000">
      </TextView>

     <TextView android:id="@+id/txt_notes"                  
        android:layout_width="fill_parent" android:layout_below="@+id/txt_status" 
        android:layout_marginTop="5dp"
        android:layout_height="wrap_content"
        android:maxHeight="18dp"
        android:textColor="#000000">
    </TextView>             
</LinearLayout>

<LinearLayout android:id="@+id/bottom_control_bar" android:layout_marginTop="8dp" android:orientation="horizontal" android:layout_width="fill_parent" 
              android:layout_height="wrap_content" android:layout_alignParentBottom="true">               
            <com.google.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="XXXXXXXXX"
                     ads:adSize="BANNER"
                     ads:loadAdOnCreate="true">
            </com.google.ads.AdView>
</LinearLayout>         
</RelativeLayout>


Hi use this may be it's solve your problem:

android:windowSoftInputMode="adjustPan" in your manifest file in activity

second:

android:gravity="bottom" set in LinearLayout 

<LinearLayout android:id="@+id/bottom_control_bar" 
android:layout_marginTop="8dp" android:orientation="horizontal" 
android:layout_width="fill_parent" android:gravity="bottom"
android:layout_height="wrap_content" android:layout_alignParentBottom="true">               
    <com.google.ads.AdView android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adUnitId="xcxxxcxcxc"
    ads:adSize="BANNER"
    ads:loadAdOnCreate="true">
 </com.google.ads.AdView>
</LinearLayout>    

see this link : http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

0

精彩评论

暂无评论...
验证码 换一张
取 消