Android ActionBar Sherlock Swipe Gesture Recogniser - android

I have an application that has action bar sherlock and SlidingMenu integrated in it, the application has only 3 pages, and they're static pages, so no big deal about them. I have one activity and 3 fragments that i am changing when using the sliding menu.
What i want to achieve is something like this image
I want the user to be able to swipe with his finger on the ActionBar, and when that happens i change the fragment that is being displayed.
Note: i got the gesture recogniser from this awesome answer, but i can't seem to find a way to attach it to the ActionBar.
If i could put a View on the action bar and detect swipe on it, that would be great, but how can i do that ?!?
One last thing, how to implement this "Page Control" in android ?!?

So the answer to my question is that i simply created a custom_actionbar.xml, and then i used this to do the following:
View custom = LayoutInflater.from(this).inflate(R.layout.actionbar_custom, null);
getActionBar().setCustomView(custom);
// and you can use the things in the custom action bar like following !!
Button btnLeft = (Button) custom.findViewById(R.id.btnMenu);
Hope it helps someone :)

Related

Custom BottomNavigationView Interactive options layout Fragments

I recently put my hands on Android development and hence have to ask here a query that I have.
In my test app I have a BottomNavigationView, which has 3 options to click. I have seen in many apps that if a selection is tapped it further slides up another sub menu. I couldn't find enough information about this feature.
Looking for a direction if anyone has came across such requirement in the past.
This feature is deprecated now. look at say goodbye to menu button
if you still want to perform some action on navigation buttons, Override onBackPressed method in your activity so that you are able to perform some action on click of back button of bottom navigation bar.

android adding a second tab bar

i am developing an android application that contains tabs. my application is like this:
Please notice that I have an action bar that contains many tabs.
Now I want to add an extra tab bar. what i mean is: in the players activity i want to have anotion action bar. for example players under 21 years and players above 21 years
how can i do that please?
what i have tried
i tried manking many bottons with view pager. and when the user press on any button, i slide the view pager. it works good. but i would like to know if there is a standard solution.
hint
i think that action bar at the top and ation bar at the botton will help. but i don't know if this is available.
thank u very mush.
The framework provides TabHost, which you can bind to the ViewPager from by setting an OnTabChangedListener and changing the current page based on the selection. It's slightly more complicated than just using buttons, but you get the tab theme

Can we implement a list on ActionBar using Sherlock Library in Android?

I am using Action Bar in my application to implement Tab Fragments. I am successful in it. But getting a small problem. I am in a need of a drop-down list at the Right Corner of the action bar and a search button. Please see the image:
You can see the red marked buttons that i need to show in Action bar and below the actionbar we have tab fragments. I am successful in generating the Fragments but getting problem in showing these buttons on Actionbar. Please help me
The overflow button is automatically generated but if you have a phone with hardware button it wont show up. You shouldn't try to force it to show up as it goes against ussual behaviour for people with phones that have a hardware button.

Dropd down tabs or drop down menus beneath ActionBar in Android

My need is to add a drop down menu like the one shown in attached image link.
http://i.imgur.com/cWtykfN.jpg
I don't know what to be used, whether it is tabs or menus. My need is when I press the last tab/menu, the sub menu should be shown and I could be able to handle the corresponding actions. Even when I handle those menus, I should be able to show the top tab/ menu without interruption.
It's called as overflow menus. Look this example, you will get an idea.
http://wptrafficanalyzer.in/blog/adding-action-items-and-overflow-menu-items-to-action-bar-in-android/
And nice explanation been given here. http://blog.stylingandroid.com/archives/1249 and for source code.ref here: https://github.com/StylingAndroid/StylingActionBar/Tree/StylingPart2
Use the ActionBar with tab-navigation-mode and if the last tab is clicked you could simply trigger a PopupMenu (even though this seems a little weird and is not what I expect to happen when I click tab).

Action bar list navigation + tab navigation - Position of spinner is not at left most

According to Jake as in Android layout with action bar and tabs, we decide to follow his 2nd suggestion.
Use tab navigation in the action bar and set a custom view with a Spinner
Together with IcsSpinner from ActionBarSherlock itself, we manage to make it work in Gingerbread and ICS both.
However, we still suffer the following problem, during landscape mode.
Note, the spinner ("Portfolio 1") is in between PORTFOLIO tab and search icon. What we want is, the spinner is at the left side of WATCHLIST tab.
Is there anything we may try out?
Thanks.
You can set custom view for your action bar, user RelativeLayout to put your spinner at left side of "WATCH LiST"
in java code: actionBar.setCustomView(R.layout.custom_actionbar_layout)
a very late answer, but this is possible. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link

Categories

Resources