Android的TabView的布局与Admob的布局、Android、TabView、Admob

由网友(浅蓝领带//)分享简介:我有一个机器人XML,我试图让广告出现在TabView的底部,但他们都没有显示出来。我想我只是失去了一些东西很简单,但我一直在寻找这样的时间太长了,我希望有人能帮助我。下面是XML:I have an android XML and I am trying to get the ads to show up at t...

我有一个机器人XML,我试图让广告出现在TabView的底部,但他们都没有显示出来。我想我只是失去了一些东西很简单,但我一直在寻找这样的时间太长了,我希望有人能帮助我。下面是XML:

I have an android XML and I am trying to get the ads to show up at the bottom of a tabview, but they are not showing up. I think I am just missing something very simple, but I have been looking at this for far too long and I hope someone can help me out. Here is the XML:

<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.Vdrop"
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:padding="5dp">
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:padding="5dp" />
            <com.admob.android.ads.AdView     
           android:id="@+id/ad" 
           android:layout_width="fill_parent" 
           android:layout_height="wrap_content"
           android:gravity="bottom"
           myapp:backgroundColor="#000000"
           myapp:primaryTextColor="#FFFFFF"
           myapp:secondaryTextColor="#CCCCCC"
  />
    </LinearLayout>
</TabHost>

有什么想法?

推荐答案

确定我想通了。你基本上需要使用相对布局,把一个广告屏幕的底部,所以我的线性布局后作出的。下面是XML:

OK I figured it out. You basically need to use a relative layout to put an ad on the bottom of the screen so I made one after the linear layout. Here is the XML:

<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.Vdrop"
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:padding="5dp">
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
    <RelativeLayout
        android:orientation="vertical"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">
    <com.admob.android.ads.AdView     
           android:id="@+id/ad" 
           android:layout_width="fill_parent" 
           android:layout_height="wrap_content"
           android:layout_alignParentBottom="true"
           myapp:backgroundColor="#000000"
           myapp:primaryTextColor="#FFFFFF"
           myapp:secondaryTextColor="#CCCCCC"
  />
  </RelativeLayout>
</TabHost>
阅读全文

相关推荐

最新文章