How to hide the animation of actionbar show and hide in android? - android

I have an activity contain an tabhost. And I use several fragments for the tabhost, each tab only has one fragment, that means the fragment size is matching the parent. However , not all fragment has actionbar.
For example, the first one hide actionbar while the other show the actionbar.
The problem is , when I show / hide the actionbar, it does not transacts instantly, but it has an amination that e.g. for the case hide->show , the actionbar is hide and leave a blank space on the screen , then the content screen will expand to fit the screen . It cause some "glitch" in the ui , so are there any way to fix it?
I tried requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌​AY);
Which the animation is hide but the actionbar is overlay the content instead of a part of the content,
Update:
The overlay of actionbar is like this screenshot , it is on top of the content. please have a look

Please see a work around here for requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERL‌​AY);
Using ActionBarSherlock; experiencing View.getLocationOnScreen() inconsistency between 2.2 and ICS/JB
Also for the hide and show method can you please confirm if you are calling it within onCreate method of your fragment?
Could you post the code where you are making the call?

Related

Strange behavior of a bottom navigation view when is set visible

I try to make an app using one activity multiple fragments pattern. I handle navigation with Navigation architecture component using a bottom navigation view. In one of the fragment I have a Recyclerview which displays a list of custom cards. On item click it navigates to another fragment where I need to hide the bottom navigation view.
The problem appears when I navigate back and set the bottom navigation view visible again. The bar seems to appear in two steps giving the feeling of lag. (first time appears just 60% of the bottom navigation view).
The behavior seems to be related with the status bar. When I change the theme to full screen or I set windowTranslucentStatus=true, everything behaves okay. In addition, first time the nav bar seems to be with exactly 24dp smaller, that is the dimension of status bar.
Have you any idea what can I do?
PS. I'm new on stackoverflow and this is my first question. I'm glad to join this wonderful community.
Delay is one way to go, but I wouldn't suggest that.
I am assuming that the your navigation view is rendered before the entire activity is rendered, which is causing it to be rendered again after the UI is rendered. Why don't you try setting the visibility after the UI is rendered, like here

How to Create ViewPager with invisible tab bar

I'm not sure a ViewPager is the way to go, but it might.
My goal is to create an App with 3 screens.
A main screen and 2 other screens the are reachable by swiping left and right from the main screen.
i would like to have the screens as Fragments.
I have used a ViewPager, but I would like to get rid of the TabBar, and just stay with the swipe.
I managed to get rid of the Tabs, but the bar remains empty. I want it to be hidden.
Is that possible?
Is there a better way to do it ?
If this question was already answered, I have failed to find it and will appreciate redirection as well.
Thanks a lot,
Giora.
In your AnsroidStudio layout screen, go to the "Design" tab. Click on the theme option and select a theme with "NoActionBar.FullScreen" AFAIK ViewPager does not have any TabBar by default.

Moving the ActionBarTabs

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.

Custom action bar with tabs wish to be at the bottom in android

I'm doing my project which is based on action bar tabs....I encountered with a problem.....it is
1.My requirement is i need to place 4 tabs at the bottom of the screen whenever I'm clicking the tab the view should be change.
2.So at first i choose tabs for this but i got to know that tabs are deprecated.
3.So i have chosen action bar with tabs and for view i have chosen fragments .
4.Still now every thing is fine and perfect.
5.But what i need is i need to place those tabs at the bottom.
6.And exactly i need tab view i tried split action bar for this but it doesn't appear to the tab view.
7.So dear developers can you please help me for this
I think i have given valid information .If you feel it as insufficient please let me know
While ActionBar has a manifest attribute: android:uiOptions="splitActionBarWhenNarrow" this won't work always, not for tabs.
The other option you have is to use a ViewPager with a FragmentStatePagerAdapter. This will make swipe-able pages from fragment. Now you can include PagerTabStrip or PagerTitleStrip in Activity layout, inside <ViewPager> tag, at top or at bottom by using android:layout-gravity attribute on it.
This will show and switch to fragment/page titles.

Showing a non-child view in tabBar ... android

I have 3 tabs in a tab bar. On top of the tap bar, I have a button. I want to be able to press the button and change the view, without removing the tab bar. I want to set clear the current tab selection of the tab bar, and want another activity to show, without hiding the tab bar. How can I do that?
Without knowing what your code really looks like there isn't much help we can give you other than some links to some methods that sound like they might help you out...
Take a look at these methods on the ViewGroup class:
ViewGroup.RemoveView()
ViewGroup.RemoveViewAt()

Categories

Resources