我有一个在图像视图下具有adview的布局。在某些情况下,我使imageview不可见,这使得我的adview无法正确调整,因为(android:layout_below attribute我已经给我的广告)。当视图不可见时在视图下放置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>
`
我已经使用Layout_above属性为AdView中把它上面的TextView因为TextView的总是visible.But当我这样做,我得到了一个错误说循环依赖是不可能在相关的布局中.Below是更好理解的图像。
我该如何解决this.Any建议表示赞赏。
给出完整的xml布局。它从上面的代码中不清楚你使用LinearLayot或者relativeLayout作为viewGroup。我想它应该是相对布局 – 2012-04-26 09:35:19
我已经使用了相对布局的两个图像浏览器,并给出了相对布局的编号,以便adview的layoutbelow和它解决.. – 2012-04-26 09:35:39