2013-08-13 2 views
-1

내 애플리케이션에 adview를 추가하려고합니다. 문제는 adview가 버튼 옆에 표시되고 화면의 하단에는 보이지 않는다는 것입니다. android : layout_gravity = "bottom"을 시도했지만 효과가 없으므로 상위 레이아웃이 선형 레이아웃입니다. 당신은 간단한 설정을 할 수선형 레이아웃의 하단에 adview가 표시됩니다.

<com.google.ads.AdView android:id="@+id/ad" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         ads:adSize="BANNER" 
         android:layout_gravity="bottom" 
         ads:adUnitId="xxxxxxxxxxx" 
         ads:testDevices="TEST_EMULATOR" 
         ads:loadAdOnCreate="true"/> 


<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="fill_parent" 
    android:gravity="center" 
    android:orientation="vertical" 
    android:layout_height="wrap_content"> 
+0

LinearLayout을 사용하는 경우 Android로 변경하십시오. layout_gravity = "bottom"to android : gravity = "bottom" –

+0

'RelativeLayout'을 사용하십시오. 이것을 확인하십시오 [답변] (http://stackoverflow.com/questions/18191535/align-fragment-on-bottom-of-screen) – zella

+0

다른 종속성 때문에 선형 레이아웃을 수정할 수 없습니다. – Psypher

답변

1

:

<com.google.ads.AdView android:id="@+id/ad" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        ads:adSize="BANNER" 
        android:gravity="bottom" 
        ads:adUnitId="xxxxxxxxxxx" 
        ads:testDevices="TEST_EMULATOR" 
        ads:loadAdOnCreate="true"/> 

또는 당신의 LinearLayout에 설정할 수 있습니다

<LinearLayout android:id="@+id/ad" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="bottom" 
        /> 
+0

다른 dependecies 및 중력 = "botton"으로 인해 선형 레이아웃을 수정할 수 없습니다. – Psypher

0

은 당연히 투명 격차에 이미지 뷰를 넣어보십시오. 광고를 마지막에 배치하고 linearLayout에 빈 공간을 남겨 둘 수 없으므로 여분의 장소와 이미지 뷰 아래에 이미지 뷰를 사용하십시오. Adview를 삽입하십시오.