2012-04-26 7 views
0

イメージビューの下にadviewを持つレイアウトがあります。イメージビューを非表示にしているため、広告ビューが正しく調整されない(android:layout_below属性私は私のadviewに与えた)。私は私が循環依存があるというエラーを得たことを行うときのTextViewが常にvisible.ButされるためのTextViewの上に配置するadviewためLayout_above属性を使用していたビューが表示されていないときにビューの下に広告ビューを配置する

`

<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> 

`

関連レイアウトでは不可能です。

enter image description here

どのように私はthis.Any提案が高く評価されて解決することができます。

+0

は、完全なxmlレイアウトを指定します。上のコードから、LinearLayotまたはrelativeLayoutをviewGroupとして使用していることが明らかではありません。私はそれがrelativeLayoutであるべきだと思います –

+0

私は2つのimageviewsの相対レイアウトを使用し、相対レイアウトのidをadviewのlayoutbelowに与えて、それを解決しました.. –

答えて

3

どのようにImageViewを見えないようにしていますか? imgView.setVisibility(View.INVISIBLE)を使用している場合、adViewの位置は保持されます。

+0

imageview.setVisibility(View.GONE); –

+0

これを 'View.INVISIBLE'に変更します。これはレイアウトから' ImageView'を削除しないので(測定段階に含まれています)、それを見えなくするだけです。そして私はそれがあなたが必要としているものだと思います。 – Rajesh

+0

はいこれも変更されました.. –

関連する問題