I've read this question and watch the video clip from Bitspin, however I'm still unable to figure out the techtique they used on ActionBar.
You can observe the ActionBar layout transition inside Timely, when navigating from the settings Fragment to the about Fragment (and navigating back), the up caret and the title is animated by zooming and fading. So how is this made possible?
Or can you let me know if there is some techtique on crossfading ActionBar layout changes? My main purpose is to smooth the transition when user opens the navigational drawer and the title changes, aciton buttons disappears.
Thanks in advance.
EDIT:
I turned on the dev options for showing layout borders and found that Timely is using custom layouts to achieve this. However this is not possible for other applications heavily relying on other ActionBar features such as ActionMenu.
So are there any alternative ways to achieve layout transitions on ActionBar and its ActionMenus?
Related
I have used Google's solution for multiple back stacks in Navigation Component. I want to setup a custom AppBar at the activity level(Idea is to have a Toolbar, A FragmentContainerView, and BottomNavigationView)
This works fine except this sets the title of the Toolbar automatically (doesn't call any particular method in the file I have linked as far as I know) .
I want to build a custom toolbar which has a TextView with multiple colors(As in half of the title is black , other half is yellow).
Any solution how to build a custom toolbar in this solution would be greatly appreciated
You can read this document about handle navigation component back stack with appBar configuration
https://developer.android.com/guide/navigation/navigation-ui
and also you can watch this course for make custom toolbar
https://m.youtube.com/watch?v=e5_C9e_gKOM
I've been interested in material design and wanted to build a layout for the main page of my app so that it looks like the default template for Scrolling Activity but also has a Navigation Drawer like the default template for Navigation Drawer Activity for easy navigation.
As an example, Google's Play Music app already does this sort of thing.
Have a look:
Scrolling list with a banner and a FAB at the top,
Navigation Drawer, accessed by swiping from over to the left
I've searched everywhere and could find a direct way for implementing such a layout. So I tried doing it on my own and with some changes here and there in the default templates of Scrolling Activity and the Navigation Drawer Activity I was able to achieve something along those lines but not exactly what I was looking for.
I was hopping if someone could present a better way of doing it.
You can still use the DrawerLayout supplied in the Android support library with a FrameLayout and ListView to achieve the Navigation drawer. In the FrameLayout, you will display a Fragment which takes a ScrollView to display scrollable content. The Fragment can also have other widgets that let you customize your layout.
I've got exactly what I wanted, you simply need to include Scrolling Activity's layout inside the layout of Navigation Drawer Activity and it works nicely.
You can use the default templates for these activities given in the Android Studio to save yourself some time or start from scratch.
Let me know if anyone needs some code and I will be more than happy to post it :)
I am trying to figure out how airbnb has implemented its Tab Bar, it either seems they have hidden their actionbar and everything has been shifted onto a tab bar but then the right most user icon opens the navigation drawer which should be ideally on actionbar, Or everything is on action bar itself but then how can those 3 tabs/icons on left be implemented on actionbar. (Kindly refer attached image)
Can somebody put some light on how this can be implemented. How to go about it? Also are those 3 icons fragments or separate activities?
Here, is a library which makes your life simpler to implement TabBarView for actionbar tabs.
https://github.com/Mirkoddd/TabBarView
This should give you insight about how to use it for your app.
I've set up a ViewPager in my App with tabs, but I need to position the tabs underneath a button so the layout would be
TitleBar
Button to search activities on a day
Tabs of each day there are activities
Is that kind of layout possible to do using Tabs or will I need a different approach to solve this?
The way the activity is running is theres a main activity, and the layout is just the button and a FrameLayout, and the the list (where the ViewPager is) is set up in a fragment and the fragment is loaded into the FrameLayout. I don't know if this is the best method for this so if not please add your recommendations of a better method I could use.
EDIT: If I could get it so all the tabs were at the bottom of the screen this would also be fine.
Is that kind of layout possible to do using Tabs
Not with action bar tabs. Not only can you not control where the tabs go, you cannot even control if there will be tabs versus a drop-down list.
will I need a different approach to solve this?
You are welcome to use some other tab solution (ViewPager with a tabbed indicator, FragmentTabHost, etc.) where you have more control.
Note that your proposed design does not adhere to Android design aesthetics. Most apps would not have "Button to search activities on a day", but instead a search action bar item, or perhaps a SearchView in the action bar.
If I could get it so all the tabs were at the bottom of the screen this would also be fine.
This is completely against the Android design guidelines. Don't use bottom tab bars on Android.
The SlidingMenu library is an excellent third party library and I've already used it for a long time. Now I know Android provides a new navigation pattern using Navigation Drawer. It looks like the sliding menu. So is there anyone who already uses these two both? What is the difference and what are the pros and cons? Thanks a lot.
SlidingMenu library is a third party api which uses a RelativeLayout inside. The main advantage is customization according to your requirement. Buy your layouts have to be based on a viewgroup, unfortunatly this negates the <merge> optimisations.
Navigation Drawer is available in the Support Library of android it uses DrawerLayout inside. The main advantage is improved performance.
They also have different visual effects. SlidingMenu looks like horizontal scroll view. Sliding it in will push the main content out.
Pros :
It comes with cool entrance / exit animations for the menu content.
Depending on what Activity you use it on, it can be placed below the Action Bar or next to it (pushing the Action Bar too)
You can explicitly set the touch mode via a setter: margin or full screen. In full screen mode touching anywhere on the screen will open the menu. In margin, only when you slide from the edge of screen will the menu open.
Cons :
You can only control the shadow of the side menu
Navigation Drawer / Drawer Layout looks like an additional top level view in a frame layout. Sliding it in will mask the main content.
Pros :
If you use v4 support lib then it's already there.
You can control both the side menu shadow and obscure the main
content via setScrimColor e.g when the drawer is opened, a fade-in
alpha layer will appear above the main content. This is good to visually separate the content and the menu especially when both have a same color.
Cons:
It can only be placed below ActionBar
There is no setter for touch mode and by default you can only do margin touch mode. Doing a full screen touch mode (like Youtube) involves a lot of work
I think the best advantage is that It is official Google code, I mean it just works and works excellent.
The main disadvantage is that it is very basic to use, I mean... you cannot put two navigation drawer in the same activity or fragment, you can only use one in left and that's it.
You already said it yourself. Sliding menu is third party. Navigation drawer is official. Both have the same purpose, but third party libraries might implementing it slightly differently, depending on which one you use.