简体   繁体   中英

ANDROID: Possible to load an Activity into a SlidingDrawer view?

I'm searching all over but cannot seem to find a answer to this.

I have my main HomeActivity view which contains a SlidingDrawer in the main.xml layout. The sliding drawer works fine. What I'd like to do though is that when the SlidingDrawer is opened, I want to launch a new activity in the sliding drawer view, and when the drawer closes it drops a result.

So in theory I'm looking at launching an activity with the startActivityForResult method and when the SlidingDrawer closes, processing the result? Is this at all possible or am I out to lunch?

I have recently given this some thought and although actually having the activity itself display inside the SlidingDrawer contents is impossible, theoretically you could simulate this buy copying the layout you are going to, and putting that as the contents, then as soon as the sliding drawer is done, go to the new activity. I haven't tried this myself but it might actually look nice. It won't be perfect but I think it could work.

Another way is to merge both those activities into one and use the sliding drawer to show the other layout.

Anybody have any better ideas I'd love to hear them also!

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