Issue
I am working on this task and I want to delay hiding this imageView until another view is loaded. So currently the problem is there is a split where it’s just displaying a dark screen as it waits for it to load which looks back. I tried using a handler but
private fun animationFromPointA() {
val transImageView = findViewById<ImageView>(R.id.trans_image_view)
Glide.with(this)
.load(file)
// I have removed the onLoadFailed and onResourceReady
.into(transImageView)
}
Solution
I think a more effective approach will be to listen to the view being drawn . When the view gets drawn you hide this view ..that was there is no dependency on the time.
The way to do this is
final LinearLayout layout = (LinearLayout) findViewById(R.id.YOUR_VIEW_ID);(use your own layout)
ViewTreeObserver vto = layout.getViewTreeObserver();
vto.addOnGlobalLayoutListener (new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// Put your imageview visibility code here
}
});
Answered By - Narendra_Nath
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.