Layout issue - how to start an activity without moving certain UI elements? - android

I'm trying to implement tab buttons bar and a navigation bar in my android application. The problem is, that I would like the navigation elements to persist. When starting a child activity, the nav bar moves.
How can I make these two elements "non-movable"?

Add button bar and navigation bar to all your activities and share it's state via static fields. Remember to initialize bars when child activity starts and update parent's bars when child activity finishes (either via onResume or as a result of startActivityForResult).
It is not possible to share instances of UI elements between activities, as Activities are (by design) independent of each other.
Application cannot control how new activity is introduced - it can slide, zoom in or just show up if user disable animation in device preferences, UPDATE: it looks like since API Level 5 there are ways to override this, please refer to Activity transition in Android . But if you really need to keep bars in place, use single Activity and replace main view content with animation you like.

Related

Android, Cicerone. Is it possible to implement cicerone with bottom navigation and Single Activity approach?

I'm using cicerone and single activity approach. When the application starts, the first three seconds I'm showing splash fragment inside my activity and so redirect to home fragment. Now I need to add to my application bottom navigation. Is it possible to add bottom navigation using single activity approach and cicerone. Or will I have to add another activity for the holding bottom navigation ?
Unfortunately, I could not find examples of projects with cicerone, single activity and bottom navigation.
My main goal is to save single activity, please tell me if it is possible to achieve this ?

Why is it recommended to hide the bottom navigation bar after leaving the main fragment?

I have read a couple of times in tutorials that it is recommended not to show the bottom navigation bar after navigating deeper into each of the main fragments of each section.
So if you have 3 sections shown in the bottom nav bar, only the 3 landing fragments will show that bar, the rest of the fragments (as you navigate deeper) will hide it.
I know it has something to do with having a single backstack, but I don't really know the real explanation or what would be the problem of not hiding it.
Could someone explain please?
Cheers!
I believe this can attributed to the Master-details UI pattern.
Master-detail wikipedia
Android tutorial - Master-Detail views with Navigation Components
You have main screen which is an activity that acts as you application single entry point, the bottom navigation bar holds the main points of interest you want your user to interact with or engage, with say [Feed, Messages, Profile], each one of those is a master view that has a set of child view linked to it, for example feeds to have your feeds for categories like [Music, Technology, ..].
From a UX point of view hiding the bottom nav-bar when navigating the children of a main/master view and have back button or home button that returns you to main screen that way your user understands the flow of your application and has easier time navigating it, and may not accidental click the [profile] button while scrolling down the feeds list.

How do i make my Floating Action Button(FAB) to visible in all the screen of app not just the page viewer

I want to make my FAB to be visible throughout the app.
I have pageviewr and im able to display FAB in all pageViewer.
- FAB works same in all the screen so.
Even i have different activity too, i want to display in those activity too.
can any let me how do i do that.
Or do i need to add the FAB button in different activity ?
Every activity in Android has its own content View, so you need to add FAB to each one.
But if you want to reduce duplications, you can make fab_layout.xml with <include> tag and use it for every layout every Activity.
Also you can implement Base activity, with providing base functionality to FAB. Or instead of parent Base activity you can implement FabHandler class and use it in each activity.

Application level floating views with navigation in Android

I have to show a floating button that will be added in WindowManager so it remain on the top of all Activities. (I have done this part using https://github.com/marshallino16/FloatingView)
When that button is tapped I have to open screen and show detail view and navigate between other views. To achieve this thing I can do following things either adding
1 - PopUpWindow
2 - Dialog
But I cannot provide navigation using either of them. So my questions is.
What is the best way to add multiple views and providing navigation between them while keeping everything above the application that is running it.
How can we add Activity so that it won't pause user application?
You should open Activity and implement all navigation inside it.
Android may pause activities behind, so make your Activity only for part of the screen.
Inside Activity hide floating button and show it again on exit.

How do I implement a slide-out drawer on the Android's call screen?

The Android app Thrutu puts a drawer on top of the in call screen which has several functions and only takes up a fraction of the screen. The call control buttons below still are fully functional. Even a transparent activity would not allow this behaviour. Any idea on how to implement this?
The trick to making the underlying buttons work is to implement the UI using a Service rather than an Activity, make the Window you add (using WindowManager.addView) one of the higher-priority types (e.g. TYPE_PHONE), then use FLAG_NOT_TOUCH_MODAL.
I think you need android.permission.SYSTEM_ALERT_WINDOW.
Take a look at How to display a fullscreen TYPE_SYSTEM_ALERT window? and in particular Creating a system overlay where the home buttons still work?

Categories

Resources