Android View Lifecycle
Asked Answered
C

1

7

I am using the SemiClosedSlidingDrawer in my app.

Quick explain:

  1. Sliding drawer has handle and content part
  2. The content part is partially opened at view creation

Problem:

When I create view the content part is inflated and cached then showing partially. If I perform any operation on the main content. It reflected to the content part of sliding drawer. Even it is partially viewable.

I managed to found the answer that the content is not set to GONE so only it is receiving touch events.

I have to set the content GONE after all inflation caching completed. So I need to know

Which View creation Lifecycle method called last? or Where to set ChildView's Visibility properties?

I can refer my slidingDrawer's content in activity and set to GONE it is working fine. But there should be a proper way to fix this issue.

Chemesh answered 24/7, 2012 at 14:18 Comment(0)
N
0

I don't get why you can't just set the content part to gone in onCreate() of your activity?

Alternatively make your own implementation of SemiClosedSlidingDrawer and override all the constructors with your own implementation. Something like this:

SemiClosedSlidingDrawer() {
    super.SemiClosedSlidingDrawer();
    mContent.setVisibility(View.GONE);
}
Nydia answered 20/2, 2013 at 9:7 Comment(4)
I said "I did it and it worked". But I just wish to know View's life cycle method called after inflation so that It will become semi-visible and will not consume events.Chemesh
I tried with the constructor trick. But the bottom content part is black [Not inflated and cached]Chemesh
@mahemadhi So you want it to be visible but you don't want it to take click events and be interact able?Nydia
@mahemadhi you can use .post on any view, that might be what you are looking after.Nydia

© 2022 - 2024 — McMap. All rights reserved.