开发者

Admob and ListActivity

I have a ListActivity with a custom layout. Now I'd like try to add AdMod my activity but I get the same problems I had when I added a button to the layout. If I have the layouts at 100px I see both list and ad but it really isn't looking good.

        <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:myapp="http://schemas.android.com/apk/res/se.javalia.myDrinks"
    android:orientation="vertical">
    <RelativeLayout android:layout_width="fill_parent"
        android:layout_height="200px"
        android:gravity="center">
    <ListView android:id="@+id/android:list" android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <TextView android:id="@+id/android:empty"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:text="@string/main_no_items" />
    </RelativeLayout>
    <RelativeLayout android:layout_width="fill_parent"
        android:layout_height="48px"
        android:gravity="bottom">
        <com.admob.android.ads.AdView android:id="@+id/ad"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF"
            myapp:secondaryTextColor="#CCCCCC" android:layout_alignParentBottom="true"
            myapp:keywords="drink alcohol wiskey rum soda" myapp:refreshInterval="300" />
    </RelativeLayout>

</LinearLayout>

Do you have any开发者_开发知识库 idea about why I don't see the ads when I have increased use 200px, and how to fill the screen without the ad disapering.

Thanks in advance Roland


at a first glance your code one prob which i think this error happens:in this code <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" android:layout_alignParentBottom="true" myapp:keywords="drink alcohol wiskey rum soda" myapp:refreshInterval="300" /> </RelativeLayout>


use fixed height for your admob custom class instead of fill parent try smaller value and you get listview visible

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜