2011-01-29 11 views
0

私は以前この質問をしましたが、「十分に良い」回答を得られませんでした。AdmobとListActivity

私の問題は基本的に、AdMobにListActivityを正しく表示させることができないことです。私のレイアウトは、このようになります

:今

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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"> 
    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> 
     <ListView android:id="@+id/android:list" android:layout_alignParentTop="true" 
      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" /> 
    </LinearLayout> 
    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > 
     <com.admob.android.ads.AdView android:id="@+id/ad" 
      android:layout_alignParentBottom="true" 
      android:layout_width="fill_parent" android:layout_height="wrap_content" 
      myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" 
      myapp:secondaryTextColor="#CCCCCC" 
      myapp:keywords="drink alcohol wiskey rum soda" myapp:refreshInterval="300" /> 
    </LinearLayout> 
</RelativeLayout> 

問題は、私はlayout_hightを変更した場合150ピクセルの広告文句を言わないショーよりも大きな値をfill_parentか試みることということです。 layout_hightが150以下の場合はうまく表示されます。目指すのは、広告が掲載された後に画面を満たすためのリストを取得することです。

提案がありますか?私はこれを解決する方法についてかなり失われています。

回答が完全に得られなかった場合は、質問を更新しますので、更新を確認してください。事前 で

おかげローランド

答えて

1

外側のラッパーとして使用1 RelativeLayoutと親上部と親一番下にあなたのadviewにあなたのリストビューを設定します。

+0

私は質問のxmlを更新しましたが、広告は表示されません。レイアウトには予約されているが広告はありません。 – Roland

+0

エミュレータまたはデバイスのテストモードを使用して、常に広告が返されるようにします。 – Phobos

0

私はこの問題を抱えており、インターネットで回答を見つけることは非常に困難でした。しかし私は運が良かったので、私のために働く答えが見つかりました。 =「wrap_content」 layout_heightと私は願っています。この

<ListView 
     android:id="@+id/android:list" 
     android:layout_alignParentTop="true" 
     android:layout_width="fill_parent" 

     android:layout_height="0dip" 
     android:layout_weight="1" 
/> 

のようになりますあなたのListview

android:layout_height="0dip" 
android:layout_weight="1" 

あなたのリストビューのコードにこれら二つの新しい行を追加します。

コード内で アンドロイドを削除してくださいそれはあなたのために働く。