In order to do this, I think they need to be fragments or something because that is what viewpager requires. I am not really sure how to do this because I have built my app up using activities, not fragments. Is there a simple way to tab between activities so that the tab bar is persistent?
Related
I have multiple classes with different layouts which I call them Widgets in my app (this is a whole different thing from so called "Android Widgets"). I want to put instances of these classes beside each other in an activity called Dashboard. So users can change the place and settings of these widgets inside the dashboard and etc... .
I tried to use DragListView library, but the problem is each list mush have one layout AFAIK.
Any suggestions?
I am trying to implement swipe tabs in my application but don't know what is the best way to do it.I am confused as to whether I should action bar navigation bars or some other mechanism.
I want my application to have Scroll-able views like in the link below?
https://play.google.com/store/apps/details?id=com.asus.todolist
You can use uiautomatorviewer to determine what that app is using. My guess is that it is using a ViewPager with a PagerTabStrip for the tabs.
I am new to android development/eclipse and have run into a problem. I have 3 working apps that I programmed that work by themselves. One of these is a app that simply displays 2 tabs that when clicked don't really do anything. What I need to do is integrate my three programs together so that when you click on the tabs they start the other 2 apps. My biggest problem right now is the layout. I have them all together and compiled with no errors, but when I run it everything is displayed with the tabs and its a mess. My question is, how can I make it so that only the right stuff displays only when a tab is clicked. My xml file is a jumbled mess with like three different LinearLayouts. I am so new I don't know where to start. Any help would be greatly appreciated!
Brian
What is displayed on the screen at one time is called an Activity. Looks like you want 3 activities, but what you have is only one Main Activity. You should display the 2 tabs on the Main Activity and then use an Intent to change between activities, when you press on the tabs.
For a reference, you can refer to the android developer site: http://developer.android.com/training/basics/firstapp/starting-activity.html
I hope this helps!
I'm building an Android application which contains a fixed header with the application title in it. Right now, when the application changes activities, the header will slide out and slide in as well because both activity's have the same header. I really like this header to stay fixed at all times, even when switching activities.
I think this could easily be done by using a viewswitcher/viewflipper on the lay-out below the header and switch views only on that perticular part of the application. That would create my desired effect. The problem with this is, that every single screen I have in my application, would use the same java file. As I have around 12/13 different screens, all containing buttons textviews, listviews etc, that would create very messy code. I'd therefore prefer to use java files for each 'screen' but then I'd have to stick with different activity's and I can't keep the header on top during transistioning of activity's.
Is there a solution to actually keep a fixed header (and be able to animate the view/lay-out below) while using different java files for every application screen?
Work with Fragments, a FragmentStatePagerAdapter and a ViewPager. You could create a layout where you have the fixed header - and below that you have your ViewPager containing the different Fragments, each containing their own logic.
It's quite a change working with Fragments instead of only Activities, however I've found them very useful. For a starting point, check this link.
To not allow the user to swipe, but still being able to switch the viewpager item programatically, check out this tutorial and do your swiping using the setCurrentItem method.
is anyone have an idea how to make tabs like the nexus one tabs from the weather/news app, and i mean the functionality which by flick the screen you could go to the next tab, Thanks
Video: http://www.youtube.com/watch?v=hIu6kCnZVF0
alt text http://www.gadget.pdamu.com/wp-content/uploads/2010/01/Google-Phone-Nexus-One-weather-apps.jpg
You can now do this out-of-the-box in the Android Compatibility library with a ViewPager: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?m=1
ViewPager slides between Fragments much the same way ListViews scroll up and down with views.
If you're not interested in scrolling the tabs, there's an example in the SDK that uses a TabHost (instead of making the tabs themselves scrollable left-to-right), but you need not use a TabHost. You could, if you wanted horizontally-scrolling tabs, use a HorizontalScrollView with some buttons in it.
For an approach that doesn't use the compatibility lib, or fragments, see here: https://github.com/olibye/AndroViews
its called a Workspaces UI pattern more information about it and how to implement it here http://www.androiduipatterns.com/2011/06/android-ui-pattern-workspaces.html