简体   繁体   中英

Android View Lifecycle

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.

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM