Android 当视图不为';看不见
我有一个布局,它在imageview下有一个adview。在某些情况下,我使imageview不可见,这使得我的adview无法正确调整,因为(android:layout_在我给adview的属性下面) `Android 当视图不为';看不见,android,Android,我有一个布局,它在imageview下有一个adview。在某些情况下,我使imageview不可见,这使得我的adview无法正确调整,因为(android:layout_在我给adview的属性下面) ` ` 我使用adview的Layout_Upper属性将其置于textview之上,因为textview始终可见。但当我这样做时,我得到一个错误,即在相关布局中不可能存在循环依赖项。以下是用于更好理解的图像 我该如何解决这个问题。欢迎提供任何建议。您如何使图像视图不可见?如果使用的是
`
我使用adview的Layout_Upper属性将其置于textview之上,因为textview始终可见。但当我这样做时,我得到一个错误,即在相关布局中不可能存在循环依赖项。以下是用于更好理解的图像
我该如何解决这个问题。欢迎提供任何建议。您如何使
图像视图不可见?如果使用的是imgView.setVisibility(View.INVISIBLE)
,则adView应保持其位置。如何使图像视图不可见?如果使用的是imgView.setVisibility(View.INVISIBLE)
,则adView应保持其位置。给出完整的xml布局。从上面的代码中不清楚您是否使用LinearLayot或relativeLayout作为视图组。我想它应该是相对的。我已经为两个ImageView使用了相对布局,并将相对布局的id提供给adview的LayoutDown,然后解决了。给出完整的xml布局。从上面的代码中不清楚您是否使用LinearLayot或relativeLayout作为视图组。我想它应该是相对的。我已经为两个imageview使用了相对布局,并将相对布局的id提供给adview的LayoutDown,然后解决了..imageview.setVisibility(View.GONE);将其更改为视图。不可见
,因为这样做不会从布局(包括在测量阶段)中删除图像视图
,只会使其不可见。我认为这就是您需要的。imageview.setVisibility(View.GONE);将其更改为视图。不可见
,因为这样做不会从布局(包括在测量阶段)中删除图像视图
,只会使其不可见。我想这就是你需要的。
<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>