2011-09-28 106 views
0

我試圖在AdView下顯示ImageView,如圖像2。問題在於EditText處於活動狀態,鍵盤顯示以及AdView加載完成後,所有工作都完美無缺,但是當AdView未加載時,ImageView向上滾動屏幕,如圖所示1RelativeLayout問題。顯示鍵盤時ImageView向上滾動

這是我的XML佈局:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
android:orientation="vertical" android:layout_width="fill_parent" 
android:layout_height="fill_parent" android:gravity="top"> 

<com.google.ads.AdView android:layout_width="wrap_content" 
    android:id="@+id/adView" android:layout_height="wrap_content" 
    ads:adUnitId="XXXXXXXXX" ads:adSize="BANNER" ads:loadAdOnCreate="true" 
    android:layout_alignParentTop="true" android:layout_centerHorizontal="true" /> 

<ImageView android:src="@drawable/frame008" android:id="@+id/imageView1" 
    android:scaleType="centerInside" android:layout_height="wrap_content" 
    android:adjustViewBounds="true" android:focusable="false" 
    android:layout_width="match_parent" android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" android:layout_marginTop="50dip"></ImageView> 

的EditText上並提交按鈕:

<RelativeLayout android:id="@+id/linearLayout4" 
    android:orientation="horizontal" android:layout_height="wrap_content" 
    android:layout_width="fill_parent" android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true"> 
    <Button android:text="Submit" android:id="@+id/button2" 
     android:onClick="submit" android:layout_height="wrap_content" 
     android:layout_width="wrap_content" android:layout_alignParentRight="true"></Button> 
    <EditText android:layout_width="wrap_content" android:id="@+id/editText1" 
     android:layout_height="wrap_content" android:layout_alignParentLeft="true" 
     android:layout_toLeftOf="@id/button2"> 
     <requestFocus></requestFocus> 
    </EditText> 

</RelativeLayout> 

感謝您的時間!

When ads doesn't load.

When ads loads

回答

0

下面的代碼片段應該是你所需要的定位的看法,只要你想:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout > 

    <com.google.ads.AdView 
     android:id="@+id/adView" 
     android:layout_alignParentTop="true" /> 

    <RelativeLayout 
     android:id="@+id/linearLayout4" 
     android:layout_alignParentBottom="true"> 
    </RelativeLayout> 

    <ImageView 
     android:layout_below="@+id/adView" 
     android:layout_above="@+id/linearLayout4"> 
    </ImageView> 

</RelativeLayout> 
+0

問題是低配的是,但沒有解決 –

+0

所以問題依然存在? – banzai86

+0

是的,問題依然存在。圖像中心垂直顯示,因此當它向上滾動時,更加明顯,但圖像的一部分仍然不可見。 –

相關問題