AD加载过程中布局问题 [英] Layout issue during AD load

查看:139
本文介绍了AD加载过程中布局问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题设置布局。

I have a problem setting up layout.

在它看起来是这样的:

AD加载后,一切都将它的位置。它看起来像这样(正确的)

After AD is loaded, everything goes to it's place. It looks like this ( correct )

是否有人知道如何解决这个问题?这并不是说只查找哪个广告加载时间丑,但广告可能永远不会还装载和布局可以保持这样的(第1图像),直到永远。

Does anybody know how to fix this problem? Not that only looks "ugly" for the time which AD is loading, but AD may never be loaded also, and layout could stay this way (first image )forever.

有什么建议?

我有这样的XML布局:

I have this XML layout:


<com.example.touch.TouchImageView android:id="@+id/mytouchview"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="5dp"
    android:layout_above="@+id/relat"
    />

    <RelativeLayout
        android:id="@id/relat"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:layout_above="@+id/myAdView"
         >

         <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="3dp" android:layout_alignParentLeft="true" 
        android:background="@null" android:src="@drawable/previous"  android:id="@+id/previous"/>

         <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="20sp" android:text="2/15"
            android:id="@+id/memeNumber" android:layout_centerInParent="true" android:layout_margin="5dp"/>


        <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="3dp" android:layout_alignParentRight="true" 
         android:background="@null"  android:src="@drawable/next" android:id="@+id/next"/>


    </RelativeLayout>



<com.csjy.sfwn148282.AdView
    xmlns:ap="http://schemas.android.com/apk/res-auto"
    android:id="@id/myAdView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ap:animation="fade"
    ap:placementType="interstitial"
    ap:banner_type="inappad"
    ap:test_mode="true"
    ap:canShowMR="false"
    android:layout_alignParentBottom="true"
/>

编辑:

在@Szymon回答布局看起来是这样的。这没关系,因为它是相同的加载广告。的问题是,现在,按钮丢失..

After @Szymon answer layout looks like this. It's okay because it's the same while loading the AD. The problem is that now, buttons are missing..

推荐答案

您顶级相对布局更改为线性布局(垂直),然后将三种布局使用layout_weight。为mytouchview的layout_weight设置为1,其它两个为0。这会给mytouchview所有的额外空间,推动按钮和广告的底部。当广告占用的空间将轻轻一按适当托盘,但它不会采取任何空间,如果不会装载的广告。

Change your top level Relative Layout to a linear Layout (vertical) and then use layout_weight on the three layouts. set the layout_weight for mytouchview to 1 and the other two to 0. This will give mytouchview all the extra space and push the buttons and ad to the bottom. When the ad takes up space it will push the button tray up appropriately, but it won't take any space if the ad never loaded.

这篇关于AD加载过程中布局问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆