Kris B
Kris B

Reputation: 3578

Overlap Activity over another Actvity

I have an audio app where the user can select an item in a list that brings the user to a separate Activity which contains the controls to play/pause/skip forward/skip back/etc.

Is it possible to have the second Activity "peek" at the bottom of the first Activity then the user can slide the second Activity up to view the play controls?

I'm starting the second Activity with this code:

Intent intent = new Intent(this, EpisodeActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("episodeid", 0);
intent.putExtras(bundle);

startActivity(intent);

Upvotes: 1

Views: 286

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007659

Is it possible to have the second Activity "peek" at the bottom of the first Activity then the user can slide the second Activity up to view the play controls?

No. You cannot have two activities both receiving user input. If the second activity can receive user input, then the user cannot also be able to interact with the first activity.

Your proposed UI sounds like a bottom sheet. You can implement a bottom sheet using fragments. Fragments themselves have been part of the Android SDK for a bit over a decade. A typical implementation of a bottom sheet would be based on BottomSheetDialogFragment.

Upvotes: 2

Related Questions