setvisibility(View.GONE)正在以INVISIBLE方式工作

时间:2018-01-15 12:35:34

标签: android

它是java代码。

 if(currentword.hasImg()){
        img.setImageResource(currentword.getImgId());
        img.setVisibility(View.VISIBLE);


    }else{
        img.setVisibility(View.GONE);

图片视图是不可见的,但仍然占用空间。 请在setvisibility中提供帮助(view.gone) setvisibility(View.GONE)正在以INVISIBLE方式工作。 拍摄空间的图像视图。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    android:minHeight="@dimen/list_item_height"
    android:background="@color/tan_background">

<ImageView
    android:layout_width="@dimen/list_item_height"
    android:layout_height="@dimen/list_item_height"
    android:id="@+id/image" />

    <LinearLayout android:layout_width="match_parent"
        android:layout_height="88dp"
        android:orientation="vertical"
        android:paddingLeft="16dp"
        android:id="@+id/text_container"
        android:gravity="center_vertical"

        >
    <TextView
        tools:text="one"
        android:id="@+id/default_textview"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:paddingLeft="9dp"
        android:textColor="@android:color/white"
        android:gravity="bottom"
        android:textStyle="bold"
        android:textAppearance="?android:textAppearanceMedium"/>
    <TextView
        android:gravity="top"
        android:textColor="@android:color/white"
        android:textAppearance="?android:textAppearanceMedium"
        android:layout_width="match_parent"
        android:id="@+id/miwok_textview"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:paddingLeft="9dp"
        tools:text="lutti" />
</LinearLayout>
</LinearLayout>

............................................... .................................................. .................................................. .................................................. .............................................

1 个答案:

答案 0 :(得分:1)

如果我理解,请尝试设置布局高度或宽度换行内容