'Android: Hide Imageview
I have a imageveiw initially it should be in hidden mode,
<ImageView
android:id="@+id/custom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:src="@drawable/custom1" />
and I created a login page ..whenever my login is successful I should show the image.
Solution 1:[1]
Set Visibility property of Imageview like this in java
imgView.setVisibility(View.VISIBLE);
imgView.setVisibility(View.INVISIBLE);
imgView.setVisibility(View.GONE);
Or like this in XML
android:visibility="visible"
android:visibility="invisible"
android:visibility="gone"
Or like this in C#
imgView.Visibility = ViewStates.Visible;
imgView.Visibility = ViewStates.Invisible;
imgView.Visibility = ViewStates.Gone;
Result for each will be like this
Solution 2:[2]
Initially to set the image view to hidden mode, try
imageview.setVisibility(View.INVISIBLE);
and when login is successfull, change its visiblity to VISIBLE,
imageview.setVisibility(View.VISIBLE);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eric Schnipke |
| Solution 2 |

