Android hide and removing the image in imageview

偶尔善良 提交于 2019-12-04 00:23:18
jennifer

You can set the visibility of an image with the following method calls:

answerState1.setVisibility(View.GONE);  // hide image (make the view gone)

answerState1.setVisibility(View.VISIBLE);  // make image visible

answerState1.setVisibility(View.INVISIBLE);  // make image invisible

In UI, you can also do something like the following:

<ImageView android:id="@+id/imgPreview" 
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
android:visibility="gone"/>

try this imageview.setVisibility(ImageView.INVISIBLE);

ShineDown

You can use answerState1.setVisibility(View.INVISIBLE); to make view invisible and answerState1.setVisibility(View.Gone); to make the view invisible.

MadDroid

Try the following code:

ImageView im = (ImageView)findViewById(R.id.imageView1);
im.setVisibility(View.INVISIBLE);
im.getLayoutParams().height = 0;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!