我使用這個佈局xml顯示我的活動和admob: 首先我認爲它會改變上面的佈局,當admob可用,但它不是... 你們有什麼想法嗎?如何在admob可用時移動android佈局?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/wonder"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textColor="#000"
/>
<ListView
android:id="@+id/auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:headerDividersEnabled="false"
android:footerDividersEnabled="false"/>
<LinearLayout
xmlns:myapp="http://schemas.android.com/apk/res/com.anim.list"
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" />
</LinearLayout>
</LinearLayout>
更新:這是我的RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.anim.list"
android:id="@+id/master"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/wonder"
>
<TextView
android:id="@+id/inf"
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textColor="#000"
/>
<ListView
android:id="@+id/auto"
android:layout_above="@+id/ad"
android:layout_below="@+id/inf"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:headerDividersEnabled="false"
android:footerDividersEnabled="false"/>
<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"
/>
</RelativeLayout>
解決
對不起哥們,我用這個佈局,以解決我的問題
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/wonder">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/home_layout"
android:orientation="vertical"
android:layout_above="@+id/ad_layout"
android:layout_height="wrap_content">
<!-- Put all your application views here, such as buttons, textviews, edittexts and so on -->
<TextView
android:id="@+id/inf"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textColor="#000"
/>
<ListView
android:id="@+id/auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:headerDividersEnabled="false"
android:footerDividersEnabled="false"
/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/ad_layout"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_alignParentBottom="true">
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res/com.anim.list"
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14db7f475a6f8d"
/>
</LinearLayout>
</RelativeLayout>
現在,我明白了!謝謝!
你爲什麼不使用你想要什麼用相對佈局實現不能使用LinearLayout來完成,因爲如果LL – ingsaurabh 2011-05-10 05:01:14
中發生向下移動,那麼它仍然不起作用......我的意思是,如果沒有廣告,當廣告可用時,listview應該填充其餘佈局廣告應該推動列表視圖...有沒有什麼不同,當我使用相對或線性,它只是相同... – BolbazarMarme 2011-05-10 06:24:24
不會的情況下,不是案件改變你的XML使用現實L並張貼在這裏然後我會建議你什麼改變你應該在其中實現你想要的 – ingsaurabh 2011-05-10 06:27:56