Friday 9 December 2011

Android - How can I check if a view is visible or not in Android ?

By using getVisibility( ) method on View we can get status of view.when we apply getVisibility( ) on view this method return any one of the below state.

View.VISIBLE - The view is visible.

View.INVISIBLE - The view is invisible, but any spacing it would normally take up will still be used.
 Its "invisible"

View.GONE -The view is gone, you can't see it and it doesn't take up the "spot".

Here the below code is for visibility status of view finding.

imageView is an view(ImageView obj)

if (imageView.getVisibility() == View.VISIBLE) {

    // Its visible

} else {

    // Either gone or invisible

}

No comments:

Post a Comment

Android SQLite Database Viewer or Debuging with Stetho

Every Android Developer uses SQLite Database to store data into the Android Application data. But to view the data in SQLite have a lot of...