We are creating a KIOSK app on API 22. We want to have custom status bar. And with two finger swipe from the top, options menu is opened where we can edit sound, wifi etc. just like regular swipe from top on android phones.
One option would be to edit Android source code, but we are wondering if there is something we can do on application level since we need to have some strings and buttons from app in that status bar, besides WiFi signal and battery.
What we have done is we added a fragment on top of the screen which acts as a status bar, and below it is a fragment container for other fragments.
Problem here is we need to have a transparent background of the fragments in fragment container, so when user opens multiple fragments, whole fragment stack is visible in the background.
Only way we could achieve this is by using fullscreen dialog fragments, but then we had to make multiple instances of our "status bar" which overlap and only looks like one view to the user:
This leads to maintaining multiple views instead of just one. Also the problem is since we are using Navigation library, when Fragment 1 changes in the background it also pops all dialog fragments, which throws the user to screen he was not on.
One thing we tried is to set dialog fragments window to be (size of screen - status bar) but then we could not click on status bar, since it is behind our dialog fragment.
We are considering of using activities instead of fragments, since then we can have transparent background and we don't need to use dialog fragments, but to have activates everywhere instead of fragments doesn't sound like a good idea.
Are there some other options?
Related
I'm using one activity as a container and multiple fragments. Some of the fragments need to display app bar, some don't while others require to show a special app bar (e.g. an app bar that shrinks when swiping up). So where should I put the app bar (or action bar), in the activity or in the fragments?
By the way, if I put the app bar inside the fragments, how should I manage the app bars properly when fragments come in or move out?
if every fragment should have a different app bar, you probably want to use a Toolbar.
Toolbar is a standalone ActionBar that you can put anywhere, in any view group. The Toolbar API is roughly the same as the ActionBar one, so you should not have any major issue migrating to Toolbar.
For your app, you should have Toolbar in every fragment, when needed and every fragment control it's own Toolbar.
Background
I have an app that has 2 activities :
splash activity, which is shown in full screen (no action bar, no notification bar)
main activity, which has both an action bar (uses actionBarSherlock) and a notification bar.
The problem
For some reason, when going from the first activity to the second, there is a "jumpy" layout process, which shows the content of the second activity without the action bar and notification bar, and a moment later it shows them both.
This causes the content below to move too, which is very noticeable.
Possible solution
As I've seen, a possible solution would be to hide the action bar and show it a bit later (500ms later), but this seems like a bad solution (making it slower and hiding for no reason), plus I need to get the actionBar items positions for another purpose (for showing a tutorial).
The question
Is it possible to avoid the "jumpiness"? One that doesn't involve such a weird workaround?
I've solved my problem doing the following:
1.- I have to optimize all the screens where the AB was shown. In some cases I used ListViews which weren't correctly implemented and that caused a noticeable load time in the activity.
2.- I have shown the status bar BEFORE starting the new activity. I mean: I've shown the status bar in the fullscreen activity just before starting the non-fullscreen one. With that I achieved that the layout of the second activity (non-fullscreen) was never resized.
With this two little changes now the AB transition is much more smoother.
You can find the complete post with my answer at: Smoother transition from fullscreen activity using ActionBarSherlock
Why don't you use some other animation slide transitions rather than default popping one?
something like this?
overridePendingTransition(android.R.anim.accelerate_interpolator, android.R.anim.slide_out_right);
Here is the Animation lists that you can use
http://developer.android.com/reference/android/R.anim.html
I'm trying to implement an application with a specific view. It needs to have a horizontal bar at the top that contains the app icon, and other buttons and spinners. These items must be static and should appear on every page of the app.
Below that horizontal bar will be a Tabbed component, with the tabs being horizontal at the bottom of the page. I can also implement the desired behavior with the tabs on top of the Tabbed component. Each tab will obviously change the fragment being displayed within the tab's frame.
I am working on an implementation that uses the ActionBar and the menu options. However, I can't get the menu options (my buttons and spinners) to appear above the tabs. And I'm not sure if menu options is the right approach. Any ideas?
Silly me! the answer was right there. I simply had to turn the title bar back on (only with no title) and the menu options would appear right into that title bar.
keep in mind that this feature is heavily dependent on the version of android and model of device that you have.
Older phones have a menu button which will bring up the same menu, as do some modern phones (like the galaxy SIII), so, be sure to test this everywhere so you know what the end-user will actually experience.
I am switching my Android app over to a more "proper" UX with the ActionBar etc. I have been trying to determine what the best/recommended navigation style would be.
My app has 5 activities that I currently switch between by using the menu/overflow menu.
My app has 1 main home screen that the user will spend most of their time on. The user needs a way to navigate to the other activities but none of them are really related to eachother. They are more like utility screens that a user will go to when they need to do some maintenance.
I am reading this link: http://developer.android.com/design/patterns/actionbar.html
I was first thinking to use an action bar dropdown navigation but that seems like it's not designed for navigation and more so for switching between views of the same data:
Use a spinner in the main action bar if:
You don't want to give up the vertical screen real estate for a dedicated tab bar.
The user is switching between views of the same data set (for example: calendar events viewed by day, week, or month) or data sets of the same type (such as content for two different accounts).
Then I was going to use ActionBar tabs but it says that is more for swiping between items that are used often:
Use tabs if:
You expect your app's users to switch views frequently.
You want the user to be highly aware of the alternate views.
I guess the last option is to put the actions into the overflow menu but this seems like i'm going backwards.
Can anyone offer some insight?
Thanks
I have decided to go with a side drawer as per here:
http://developer.android.com/design/patterns/actionbar.html
Open a drawer from the main action bar if:
You want to provide direct navigation to a number of views within your app which don't have direct relationships between each other.
I want to create a app with a menu at the bottom of the screen. This menu should be visible any time the app is started.
Im working with fragments, so the menu is one fragment.
So I have only one Activity as controller which loads different fragments above the menu fragment.
Because I want to create clean code, i dont know how to solve the problem that the Activity class is too big.
In other words, i want to create different controller within the same activity. How to do that?
Is there another approach to solve this issue?
You should be using the split action bar This allows you to put the Actions and overflow menu on the bottom of the screen. I believe you can use Action Bar Sherlock for backwards compatibility to older versions of Android. See their site for detail.
Another possibility is to look into using fragments with the ViewPager . Here is a library that works with compatability as well ViewPageIndicator . Here is a blog post , like I indicated in my comment I got this working with the tabs showing at the bottom and the pages above.