0

次の XML レイアウトがあります。

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

                <ScrollView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:fillViewport="true"
                    android:layout_above="@+id/adcontent1"
                    android:background="#0000FF">

                    <TextView
                    android:id="@+id/tempview"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"/>

                </ScrollView>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#FF0000"
                    android:layout_alignParentBottom="true"
                    android:id="@+id/adcontent1" >

                    <com.google.ads.AdView
                        xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
                        android:id="@+id/adview1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:adSize="BANNER"
                        app:adUnitId="lah-di-da"
                        android:layout_alignParentBottom="true"
                        android:layout_centerHorizontal="true">

                    </com.google.ads.AdView>

                 </RelativeLayout>

            </RelativeLayout>

問題は、何らかの理由でwrap_contentAdView RelativeLayoutheight 属性が原因で全体RelativeLayoutが画面全体を占有することです。ハード値(50px)を設定するScrollViewと、画面全体を占めるようになります-50px(RelativeLayout高さが高さと等しくなければならないことを除いて、私が望むように。親が強制的に画面を埋めるAdView理由を知っている人はいますか?AdViewRelativeLayout

注:これらの背後にはレイアウトがありますが、この特定の問題には影響しません (高さ = 50px を設定してテストした場合)。

4

2 に答える 2

2

広告の高さを「50dp」に設定して、結果を投稿してみてください

于 2013-05-02T12:09:04.190 に答える
1

android:layout_centerHorizontal="true"で動作しないためwrap_contentfill_parent中心にする必要がある領域を知っているため、動作します)。CenterHorizo​​ntal コードを削除し、Ads を動的に提供できない高さの値を提供する代わりに、wrap_content を使用します。

于 2013-05-06T18:56:44.440 に答える