0

imageview の下に adview を持つレイアウトがあります。いくつかの条件では、imageview を非表示にして、adview が適切に調整されないようにしています (android:layout_below 属性が adview に与えられています)。

`

<ImageView
    android:id="@+id/previous"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="5dp"
    android:layout_marginTop="10dp"
    android:background="@drawable/le"
    android:clickable="true"
    android:contentDescription="@string/app_name"
    android:onClick="previous"
    android:paddingBottom="3dp" >
</ImageView>

<ImageView
    android:id="@+id/next"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_marginRight="5dp"
    android:layout_marginTop="10dp"
    android:background="@drawable/ri"
    android:clickable="true"
    android:contentDescription="@string/app_name"
    android:onClick="next"
    android:paddingBottom="3dp" >
</ImageView>

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

<TextView
    android:id="@+id/tv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="18dp"
    android:layout_below="@+id/adView"
    android:textColor="@color/red"
    android:textSize="20dp"
    android:textStyle="bold" />

<ListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/tv"
    android:layout_marginTop="6dp"
    android:cacheColorHint="#00000000"
    android:clickable="false"
    android:dividerHeight="30.0dp"
    android:fadingEdge="none"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:scrollbars="none" >
</ListView>

`

textview は常に表示されるため、adview に Layout_above 属性を使用して textview の上に配置しました。

ここに画像の説明を入力

どうすればこれを解決できますか。提案をいただければ幸いです。

4

1 に答える 1

3

どうやってImageView見えないものを作っていますか?を使用している場合imgView.setVisibility(View.INVISIBLE)、adView はその位置を保持する必要があります。

于 2012-04-26T09:34:30.087 に答える