2015-01-01 7 views
0

의 맨 아래에 내가 XML 디자인 다음 한 -플로트 배너 광고 화면

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_alignParentTop="true" 
    android:background="@drawable/wall" 
    android:orientation="vertical" 
    tools:context="com.ahl.XXXXX.MainActivity" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" > 

     <Button 
      android:id="@+id/XXXXX" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1.5" 
      android:background="@color/XXXXX" 
      android:onClick="openXXXXX" 
      android:text="@string/XXXXX" 
      android:textColor="@color/White"/> 

     <Button 
      android:id="@+id/XXXXX" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1.5" 
      android:background="@color/XXXXX" 
      android:onClick="openXXXXX" 
      android:text="@string/XXXXX" 
      android:textColor="@color/White"/> 

     <Button 
      android:id="@+id/XXXXX" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="2" 
      android:background="@color/XXXXX" 
      android:onClick="openXXXXX" 
      android:text="@string/XXXXX" 
      android:textColor="@color/White"/> 

     <Button 
      android:id="@+id/XXXXX" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/Gray" 
      android:onClick="openXXXXX" 
      android:text="@string/XXXXX" 
      android:textColor="@color/White"/> 
    </LinearLayout> 

    <com.google.android.gms.ads.AdView 
     android:id="@+id/adViewB1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     ads:adUnitId="ca-app-pub-6805003743867442/4243673212" > 

    </com.google.android.gms.ads.AdView> 

    <ProgressBar 
     android:id="@+id/progressBar" 
     style="?android:attr/progressBarStyleHorizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"/> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <WebView 
      android:id="@+id/WebView" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"/> 

    </ScrollView> 

</LinearLayout> 

나는 화면 하단에 배너 광고를 떠합니다. 나는 상대적 레이아웃을 사용해 보았지만 webview와 잘 작동하지 않는다. 나는이 같은 다른 질문을 보았지만 여기서 웹뷰는 모든 화면을 다룰 때 몇 가지 문제를 일으키고있다 ... 그래서 나는 linearlayout을 사용해야했다.

웹 뷰 위로 또는 부모 Linearlayout 위에 광고를 플로팅해야합니까 ??

위의 XML에서 화면 맨 아래에 광고를 가져 오기 위해 내가 할 수있는 변경 사항은 무엇입니까?

+0

왜 상대 레이아웃을 사용할 때 웹보기가 전체 화면을 차지합니까? 높이를 설정할 수 있습니다. – SLee

답변

1

화면 하단에 AdView를 표시하려는 것입니다. float 이상의 모든 것을 AdView에 표시하고 싶지는 않습니다.

layout_weight="1"을 사용하여 WebView를 확장하여 사용되지 않은 공간을 채우고 그 아래에 AdView를 표시하십시오. 예 :

<ProgressBar 
    android:id="@+id/progressBar" 
    style="?android:attr/progressBarStyleHorizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
> 

    <WebView 
     android:id="@+id/WebView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

</ScrollView> 

<com.google.android.gms.ads.AdView 
    android:id="@+id/adViewB1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="ca-app-pub-6805003743867442/4243673212" > 

</com.google.android.gms.ads.AdView>