我正在为一个小屏幕设备实现一个布局。
为了进行测试,我使用的是一台分辨率为240x320的华为Ideos U8150。
由于分辨率小,我有一个主要的空间问题。所以我想我可以把一个AdMob AdView和一个TextView放在一个水平LinearLayout中。
AdView大小将占宽度的3/4,TextView占1/4。
在图形化布局工具中,一切看起来都与预期的一样。但当我在设备上运行这个应用程序时,它不会在AdView内部显示广告。我将AdView的背景设置为红色,这样我就可以确认AdView实际上是可见的。它只是不显示广告。
我向onReceiveAd确认了我收到了广告。然后我用这个方法打印AdView的框架。记录为原点: 0,38宽度: 180,47。对我来说也没问题。
所以我想知道AdMob AdView是否能够调整其广告的大小以使其正确显示。也许我尝试的事情是不可能的。
这就是我的布局:
<LinearLayout android:id="@+id/linearLayoutAds" android:background="#F0F0" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_alignParentTop="true">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_weight="3"
android:background="#FF00"
ads:adSize="BANNER"
ads:adUnitId="foobar"
ads:loadAdOnCreate="true"
ads:refreshInterval="30"
/>
<TextView
android:id="@+id/textView1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_weight="1"
android:background="#F000"
android:gravity="right"
android:text="999"
android:textSize="45dip"
android:textStyle="bold"
/>
</LinearLayout>发布于 2012-01-30 00:34:58
如果您的线性布局的高度小于50dp,广告将不会显示。我没有尝试减少宽度,但在看了这个thread之后,似乎不可能将宽度减少到180px。
https://stackoverflow.com/questions/9052995
复制相似问题