Need Swipe tab bar position but not in the action bar - android

I am trying to implement the tabs somewhere in the screen but not at the top as displayed in the screenshot.
I tried action bar tabs but these tabs always attached to action bar i.e at the top of screen. How can i use TABS below the image as shown the screenshot.
Thanks

you can try this:
PagerSlidingTabStrip
or if you want to have a google one you can try:
PagerTabStrip
the implementation of the first one is straight forward and explained in the link for the second one copy the java files from view folder and add them to your project and the rest of the work is similar to the first one.
in xml:
<com.example.android.common.view.SlidingTabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
and then you can use ViewPager to change the views.

Related

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

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.

android action bar with tabs below the screen

For my application , I'm planning to have a design as this:
http://img811.imageshack.us/img811/7045/problemel.png
-Design needs to have a title bar which is indeed the action bar in android. To overcome the compatibility issues, I used the sherlock action bar which is said to support older versions that dont have action bars. I havent tested yet for the older devices however.
-As far as I know, for navigation , we could rather use tabbed or dropdown list methods. I want to have constant tabs for every page in my app to stand below the page. This reflects the tabbed action bar, however I want it below not just under the action bar. I don't know how but youtube application somehow has it in the middle of the screen (if it's not a custom view). So how do we have tabs positioned in the bottom of the page?
-Also I want to have another menu, whose items depend on the page it's on. But the apperance will be the same for every page. In the picture on the left this menu has buttons as "Bt 1" ,"Bt 2". I dont want to repeat the same xml for every activity page, but I'm not sure how to achieve it without repeating. If the action bar allowed using both navigation tabs and the drop down list, I could put the items of this menu in the dropdown list just as the picture on the right (onto the gray button). But I guess it does not?!
Therefore I have to repeat the menu xml code in every page or is there another smart way?
Any advice will be appreciated.
This can be achieved not with tabs but by adding items to a linear_layout with a gravity of bottom but it is a bad practice as #D_Steve595 stated and should be avoided in android designs.
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);

Android Custom Tab Bar

I am looking to create a tabbed application similar to Iphone's tab-bar. There will be a bottom tab bar in my app which will go to certain screens.
(example of my page layout):
[tab1] Book List -> Book Details
[tab2] Settings1 -> Settings2
[tab3] About
I need each tab to have its own separate navigation stack. So if I go from Book List to Settings1, to Settings2 and press back, I expect to be on Settings1. From there if I press back, I expect to still stay on Settings1 because all the tabs are separate from each other.
1) I tried using Android's native Tab Host but the tabs are placed at the top... so I placed the tabs at the bottom in my XML layout.
Issue: However my phone's scroll wheel doesn't work properly: When I'm on the tab and I want to get to the above content, I scroll UP (GOOD). When I'm on the content and want to get to the below tab I have to scroll UP (BAD, you should scroll DOWN to get it).
Is it possible to scroll down to reach the tab and scroll up to go back to the content?
2) Does anybody know any other lesser-GPL API that can achieve this? Or must I start from scratch?
Thanks.
You can use layout_gravity="bottom" in TabWidget to show tab bar in bottom like this:
<TabWidget
android:id="#android:id/tabs"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_width="fill_parent">
</TabWidget>

Android creating Bottom Bar Menu

I want to have an static bottom menu bar exist through out the applications in every page visible at bottom all the time. I have designed the menu bar but i am confused whether i have to integrate the menu code with every layout xmls to make menu visible in every page and write the code in every activity class to perform functions on menu clicks. Or if there is any other way i can create a common bottom bar that lies with every page with writing the code of menu in a single activity class.
Well the best way in my opinion , is to create a bottom bar xml file , and include it in every Activity's xml file
<include android:layout_width="fill_parent" layout="#layout/bottom_bar" />
where your bottom bar xml file name is bottom_bar.xml
This article also might help you
http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html
There is also the include route:
Common layout in all tabs
What you are probably looking for is one Activity with a TabBar with tabs at the top and buttons at the bottom: Android: Tabs at the BOTTOM
Then you can use different Views that correspond to Tabs instead of separate Activities.

Categories

Resources