0

私はGoogleのリストビューチュートリアル(http://developer.android.com/resources/tutorials/views/hello-listview.html)に従っており、リストビューに広告ビューを広告しようとしています(常にトップに留まるように) 、しかし、私はそれを働かせることができません。relativelayout と linear を試しましたが、うまくいきません。広告ビューをボタンに置​​き換えてみましたが、ボタンも表示されません。現在、私はこのコードを使用しています:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.google.ads.AdView android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adUnitId="bannerID"
    ads:adSize="BANNER"
    ads:loadAdOnCreate="true"/>

<ListView android:id="@+id/listView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>

</LinearLayout>

このコードは、グラフィカル レイアウトでは適切に見えますが、アプリを実行すると、list_item.xml のテキストビューに隠れてしまいます。誰でもこれを機能させる方法を知っていますか? 本当に感謝します。

4

2 に答える 2

0

ListView の layout_height を wrap_content に変更してみてください

于 2011-11-19T18:02:48.393 に答える
0

layout_height を fill_parent ではなく wrap_content に変更します

<ListView android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
于 2011-11-19T18:03:40.840 に答える