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>
Related
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.
I am using the SlidingTabLayout.java and SlidingTabStrip.java classes to implement a tab navigation inside my app like described here.
Everything works fine and I really love this two classes. But I would like to center the selected tab (whether navigated through slide or click on the tab) to be in the middle of tab navigation. Right now it is always on the left side (except when you reach the end of the tab navigation than it is right). Also when you click on a tab the navigation scrolls back to the current tab and scrolls then to the tab you just selected. Is there anyway to stop this scrolling and just to center the clicked tab?
Using the method
slidingTabLayout.setDistributeEvenly(true);
does not do the trick.
I tried to read through the code and find a good starting point but I did not succeed. Does anyone know how to achieve that? Any good advice is highly appreciated.
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.
Basically, right now I have an Android app that has four tabs on the top. One of the tabs is 'Settings', but instead of it being on of four tabs I have, I want it to be inside another tab called 'Demos,' so when someone clicks the 'Demos' tab, they can click a button to open the 'Settings' page and in the future any other activity tabs I want. A screenshot is below of what the iOS equivalent is if what I wrote is confusing. Thanks.
Previously I wanted to use Tabs on top of the page using TabActivity.
As I am working with Honeycomb I used Action Bar Tabs. That worked best for me.
Now, I want to use tab to on Login page, so that user can Log in two diff ways. For this, I thought I will put Tabs at the top of Login layout (center of the page and not top of the page).
Can I do that ? How?
you can have a tabhost with multiple views and even multiple activities in each tab.
Here is a tutorial : http://joshclemm.com/blog/?p=59
The tab host doesn't have to occupy the whole screen you can have something else on top, I sometime put a textview with the title.