我想放在一个广告,但一旦广告加载了,一切在节目中消失了只留下了广告。
< XML版本=1.0编码=UTF-8&GT?;
<的LinearLayout机器人:ID =@ + ID / LinearLayout中的Android:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT的xmlns:机器人=http://schemas.android.com/apk/res/android的xmlns :广告=http://schemas.android.com/apk/lib/com.google.ads>
< com.google.ads.AdView
机器人:ID =@ + ID / AD浏览报
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
广告:adUnitId =a14ddfjakd; FS; JDS; jf4bd
广告:adSize =大旗
广告:loadAdOnCreate =真/>
<滚动型机器人:ID =@ + ID / scrollView1机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT>
<的LinearLayout机器人:ID =@ + ID / linearLayout2机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT>
< ImageView的机器人:SRC =@可绘制/项目的Android:layout_width =FILL_PARENT机器人:layout_gravity =中心的Android版本:layout_height =WRAP_CONTENT机器人:ID =@ + ID / imageView1机器人:scaleType =中心>< / ImageView的>
< / LinearLayout中>
< /滚动型>
< / LinearLayout中>
解决方案
您linearlayouts高度设置为FILL_PARENT,并导致一个问题,因为它的父,你的滚动视图,也设置为高度。FILL_PARENT
试试这个:
<滚动型机器人:ID =@ + ID / scrollView1机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT>
<的LinearLayout机器人:ID =@ + ID / linearLayout2机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT>
< ImageView的机器人:SRC =@可绘制/项目的Android:layout_width =FILL_PARENT机器人:layout_gravity =中心的Android版本:layout_height =WRAP_CONTENT机器人:ID =@ + ID / imageView1机器人:scaleType =中心>< / ImageView的>
< / LinearLayout中>
< /滚动型>
< / LinearLayout中>
I am trying to put in an ad but once the ad loads up, everything else in the program goes away leaving nothing but the ad.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a14ddfjakd;fs;jds;jf4bd"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
<ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout2" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:src="@drawable/item" android:layout_width="fill_parent" android:layout_gravity="center" android:layout_height="wrap_content" android:id="@+id/imageView1" android:scaleType="center"></ImageView>
</LinearLayout>
</ScrollView>
</LinearLayout>
解决方案
Your linearlayouts height is set to fill_parent and that causes a problem since it's parent, your scrollview, is also set to height:fill_parent.
Try this:
<ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout2" android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:src="@drawable/item" android:layout_width="fill_parent" android:layout_gravity="center" android:layout_height="wrap_content" android:id="@+id/imageView1" android:scaleType="center"></ImageView>
</LinearLayout>
</ScrollView>
</LinearLayout>