10891

Android how to set a transparent image resource of a view? or Remove the image?

((ImageView) v.findViewById(R.id.imageViewHeart1)).setImageResource(R.drawable.heart);

I d like to remove my graphicss from my Image Resource so:

((ImageView) v.findViewById(R.id.imageViewHeart1)).setImageResource(null);

or something, how can I do this?

Answer1:

If you remove image then used

((ImageView) v.findViewById(R.id.imageViewHeart1)).setImageResource(0);

Answer2:

Use ImageView.setImageDrawable(null); or simply View.setVisibility(View.INVISIBLE);

Answer3:

Try add transparent png with 1px width and 1px height.

Recommend

  • 'init is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memo
  • iOS 5 upgrade changed font appearance
  • Entity Framework Code First Circular Dependices
  • Android toolbar overflow menu change text color and fill menu to the screen
  • problem with code to combine two images in android?
  • “class template has already been declared as a non-class template”
  • Tiny Images, No Rotation, but still get OutOfMemoryError: bitmap size exceeds VM budget
  • Android ripple for button not working
  • C# foreach - Is collection computed with each iteration? [duplicate]
  • Change Design Support Navigation View Header Title Programmatically
  • How to get a android ListView item selector to use state_pressed
  • How to Handle Click on Imageview in Custom Listview with image and Textview?
  • Android: How do you create an EditText field in java class
  • Picasso Taking time to load images
  • write text on image and show it to a imageview
  • CloseOptionsMenu doesn't work?
  • Unable to resolve Static method?
  • In Java, how can I construct a File from a resource?
  • JBoss External Properties Files in Classpath
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • With Hadoop, can I create a tasktracker on a machine that isn't running a datanode?
  • Python urlparse: small issue
  • FileReader+canvas image loading problem
  • Regex thinks I'm nesting, but I'm not
  • Launch Runnable Jar from Web Start
  • What is the “return” in scheme?
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • How to set my toolbar fixed while scrolling android
  • Linker errors when using intrinsic function via function pointer
  • How to disable jQuery.jplayer autoplay?
  • How to delete a row from a dynamic generate table using jquery?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How to stop GridView from loading again when I press back button?
  • LevelDB C iterator
  • python draw pie shapes with colour filled
  • How can i traverse a binary tree from right to left in java?
  • Android Heatmap on canvas or ImageView