I was just curious if anyone could link me with some help or show me some code that would show a tab view with scrollable content like the pulse app both horizontal and vertical scroll content. I have it working entirely using TabActivity and Activity classes but I am have a really hard time converting it to either using fragments and or ActionBarTab setups since TabActivity has since been depreciated. It has been bothering me and I have been reading the API but I was just curious if there were any simple examples to where I could see how to set that up using FragmentActivity and Tab Manager or the ActionBar.
Thank you in advance.
You can use ActionBarSherlock. It is very neat and back-compatible.
Related
Let me try to make my question much clearer here. Supposed I have a custom tab created by using buttons and images in XML layout and it looks like this.
Each of these buttons, should call a class. Normally, Intent is used to call new class when onClick. But the whole layout would be redrawn when I call any of the classes via Intent.
Intent intent1 = new Intent(TabBar.this, Favourites.class);
startActivity(intent1);
I tried using TabHost and it worked, but my project requires me to use a custom tab bar.
I also tried the solution to this Dynamically change view inside view in Android, which is similar to what I wanted, (switching layouts and maintaining the tab bar below it), which worked as well.
My goal is to maintain the custom tab that I have, and change the classes instead of layout without redrawing the custom tab bar everytime I click on every buttons. With classes, I can run different functions and call different activities.
I googled a lot on this but couldn't seem to find a solution or reference. Can somebody guide me? Thanks in advance.
Update :
I'm new in Android, and after attempting many times, I decided to try out codes from AdilSoomro to achieve what I wanted, http://adilsoomro.blogspot.com/2011/06/iphone-like-tabs-in-android.html which is to create custom tabs that looks like iPhone tabs. However, this project uses TabActivity that is now deprecated in Android 4.1. I attempted to change it to FragmentActivity after referring to other sources that uses Fragments for tabs.
http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
I managed to create it using FragmentActivity and here is where you can refer to them :
How to use custom iPhone tab in FragmentActivity?
You can use TabHost control to achieve this. Go through this post
It explains all the possibilities. It also includes using custom tab bar defined in the xml file.
One of the way to achieve this is create footer and use it in all your activity. Like This. And Let me know its useful as per your requirement or not.
I'm developing an application for android that is supposed to have three tabs that shows three different listviews. It should look pretty much like this video example:
http://www.androidhive.info/2012/05/android-combining-tab-layout-and-list-view/
The problem i have is that TabActivity is deprecated and i can't found any good tutorials for the Fragment view (which I think is the one to replace TabView). Anyone know how to combine these two views?
You might want to look into ActionBar and Fragments. Maybe the following link could help you out? http://www.lucazanini.eu/2012/android/tab-layout-in-android-with-actionbar-and-fragment/?lang=en
I've been updating an Android app today which so far had a single TableLayout-based View. Now, I'd like to duplicate that View with another set of backing data, and use horizontal swiping to switch between both. At some point I'd also like to add a third "page" with a different TableLayout.
I haven't really found any good ways to get this going. I've been looking at http://developer.android.com/training/implementing-navigation/lateral.html, and I actually copied the code fragment for the Tabs Pattern with NAVIGATION_MODE_TABS. That results in a little dropdown widget being added to the View title in the action bar, but clicking it doesn't show the tabs I set up (with actionBar.addTab()). I'm also not sure how to set up the view (XML) code to stick the TableLayouts in there.
I should mention that I don't have to care for pre-4.0 Android for this, so compatibility is not (much of) an issue.
Try to Use ViewPager Widget you can find useful links on the web, this widget handle the horizontal swiping between views.
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
https://github.com/JakeWharton/Android-ViewPagerIndicator
http://blog.stylingandroid.com/archives/537#
I haven't really found any good ways to get this going.
Try ViewPager. Here is an Android Developers Blog post on ViewPager: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Here is a small sample app using ViewPager: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/Fragments
None of the other answers ended up helping much. However, this one is pretty good:
http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/
so I wanted to implement tab views on my app.
But I realised the google tutorial on tab views is broken and TabActivity is deprecated.
I tried inserting the tabhost element through the Graphical Layout but it won't even show up when my app starts.
It's just a blank screen.
What am I supposed to do/look for? I'm kind of lost here.
Thank you for any help/input.
As you can see from its docs, TabActivity has been replaced with Fragments. Here's a sample project.
Can I implement a tab host which will remain in overall application and works through out the application .
and
Also can i implement the tab host on the top and on the bottom of the same activity.
Any tutorial any help please....
Thanks
This is possible if you use Activity Group. But still it is deprecated and hence you cannot use it for newer versions of android. But still, you can go through what it is and try to implement it.
ActivityGroup Example
http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/
http://gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity
So now since Activity Groups are deprecated what is the alternate strategy we can make use of? Here is the solution for this problem.
Go for fragments or Views.
I have pasted the comment which I recieved from Commonsware regarding the ActivityGroup.
You never needed ActivityGroup to use tabs. You can put views in tabs, for example (github.com/commonsguy/cw-android/tree/master/Fancy/Tab). Going forward, tabs are in the action bar on Honeycomb, typically using fragments. You can achieve the same functionality on previous versions of Android using ActionBarSherlock.