Справка по макету (реклама покрывает веб-просмотр) - PullRequest
0 голосов
/ 04 сентября 2011

Сейчас мои объявления покрывают верхнюю часть моего веб-просмотра, и я хочу, чтобы они отображались над веб-обзором, а затем веб-просмотр начинается прямо под ними ... вот мой файл макета:

<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:myapp="http://schemas.android.com/apk/res/com.music.promotion.free"
 xmlns:ads="http://schemas.android.com/apk/res/com.music.promotion.free"
 android:layout_width="fill_parent"
 android:background="#000000"
 android:layout_height="fill_parent"
 > 

<WebView android:id="@+id/web_engine"  
         android:layout_width="fill_parent"  
         android:layout_height="fill_parent" 
        />

        <com.google.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="a14dc0dc7949bae"
                     ads:adSize="BANNER"/>                               
        <LinearLayout android:id="@+id/footer" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:layout_alignParentBottom="true" style="@android:style/ButtonBar">



<Button android:id="@+id/btnPause" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:layout_weight="1"
    android:text="Pause" />

<Button android:id="@+id/btnPlay" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:layout_weight="1"
    android:text="Play" />              


Я попробовал это, и теперь они, кажется, вообще не появляются ..

<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:myapp="http://schemas.android.com/apk/res/com.music.promotion.free"
 xmlns:ads="http://schemas.android.com/apk/res/com.music.promotion.free"
 android:layout_width="fill_parent"
 android:background="#000000"
 android:layout_height="fill_parent"
 > 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="50dp"> 
    <com.google.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="a14dc0dc7949bae"
                     ads:adSize="BANNER"/>
                     </LinearLayout>

<WebView android:id="@+id/web_engine"  
         android:layout_width="fill_parent"  
         android:layout_height="fill_parent" 
        />

Ответы [ 2 ]

0 голосов
/ 06 сентября 2011

Я исправил это, поместив это в относительный макет:

         <LinearLayout android:id="@+id/footer" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:layout_alignParentBottom="true" style="@android:style/ButtonBar">

<Button android:id="@+id/btnPause" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:layout_weight="1"
    android:text="Pause" />

<Button android:id="@+id/btnPlay" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:layout_weight="1"
    android:text="Play" />


</LinearLayout>

<WebView android:id="@+id/web_engine"  
         android:layout_width="fill_parent"  
         android:layout_height="fill_parent"
         android:layout_above="@id/footer" 
        />
0 голосов
/ 04 сентября 2011

Показ объявления не имеет фактической высоты при создании просмотра.Таким образом, он будет 0dp в высоту, а затем при заполнении будет лежать поверх вашего веб-просмотра.Вам нужно выделить место для рекламы в XML.Высота рекламного баннера составляет 50 дп.Оберните ваш com.google.ads.AdView в этот линейный макет, чтобы исправить.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="50dp"> 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...