Scrolling left/right to new pages - java

I am creating an application which displays several "pages" of content. Typically this is representative as tabs on a desktop based application.
On android, I want to be able to flick between the tabs of information, using there finger anywhere on the screen. The content of these tabs will just be XML views, or programmatically created views.
Looking at Applications on android, there are several applications that do this. Google Play, Gmail, Beautiful Widgets, BBC News, Contacts, Engadget.
I've looked for several terms, mostly scrollable tabs but haven't found anything that is similar to the above applications. I'm looking at TabHost, TabWidget and ViewPaper at the moment, but not sure if these do what I'm looking for.
Can anyone tell me which control can be used in android to get the functionality. Out of the apps listed I'm looking to have it styled more like the Google Play store, with the name of the tab at the top, and the names of the nearby tabs to the left and right if applicable.

There is an example on the android blog for this, used on google play app.
Horizontal View Swiping with ViewPager

Sounds like you're looking for this. It's compatible with ViewPager, the v4 compatibility library, and ActionBarSherlock.

Related

How to create a horizontally scrollable header in Android Studio?

guys I am developing an Android Studio, and I would like to create a scrollabe header, a similar one that this app has: Donald Trump Soundboard.
Do you know any lectures on youtube or anywhere where I can learn a required skills to create such a header?
If you want to have a scrollable Tab Layout, I have created an android library that does just that. It has custom animations too if you're into that. You can take a look here
and see if it suits your purpose.
I just saw the app, the one you are talking about is swipe​ view. The tabs are not fix rather it moves. It has been asked here( How to make scrollable tab in Android? )

How can I make a carousel?

I'm looking to create a carousel that snaps to whatever page covers most of the screen after a swipe, similar to how swipes can move through pages of android shortcuts and widgets. Similar to this. Each page should be able to display any assortment of layouts, data, or pictures.
I have looked at the resources on the "Creating an Android Image Carousel" page by Giancarlo Leonio. However, most questions are unanswered or do not apply to android.
I have seen tutorials with a viewpager, but they immediately switch pages after a swipe. I prefer that the pages appear to be connected.
You are looking for ViewPager. I don't know where you found these tutorials that lead you to believe that the interactions would appear that the pages are not interconnected.
You can find a good tutorial and demo transitions on the official documentation: http://developer.android.com/training/animation/screen-slide.html
Additionally, if you also want the indicators that Carousels would normally have you can take a look at the most popular library out there for ViewPagers...
ViewPagerIndicator
Sample App on Google Play

Designing xml layouts for different screen: Android

I am working on a small app, with 3 buttons on left corner(Vertically) and a edit box which covers rest of the screen.
I want to run this app to be able to work on all screen resolutions.
So I have used Relative layout, linear layout and Android:weight for buttons, which equally share the size of the buttons and works fine.
My Question is am I doing it wrong?
Should we design different layouts for different screens or using same layout out but adding properties like weight and padding is fine??
So, you want a responsive layout for your android app.
Pointing to your question :
[+1] layout -> Relative / Linear (in addition to the relative layout)
property (Buttons) -> Android:weight
is the right thing you are doing for your app.
Alternative:
But if you want a more responsive design then you could follow responsive design techniques by using html5 & css3 media queries etc. . And, could opt for a fluid layout also. By doing this the advantages you will have are:
Won't have a native UI only for android but the same could be used for other platforms (iOS,blackberry etc.) if you require.
The design would be more seamless with the native browser and the widgets won't get obsolete ever in the newer versions of your android
platform also and changes once done would be reflected over the other
platforms too.
More info: MUST READ IF YOU WANT CLEAR UNDERSTANDING OF HOW TO DESIGN FOR ANDROID
http://developer.android.com/design/style/devices-displays.html
http://developer.android.com/design/style/metrics-grids.html#48dp-rhythm
you can see this Supporting Multiple Screens and also Designing for Multiple Screens
To support different screen size you have to implement different layout.
Under res directory you should create these directory:
layout
layout-small
layout-large
layout-xlarge
In each directory you implement your layout. be aware to call all the layouts with the same name.
If you want to support the landscape mode too you have to add:
layout-small-land
layout-large-land
layout-land
When, in Eclipse, you open the layout select the tab called 'Graphical Layout' , you will see how your layout will be displayed. Change the screen size using the options in the upper left side and you can check how it will be displayed in different screen size.
If something is wrong you can open the xml using and correct it.
I've created a small tutorial here Multiple screen support
Hope this help you

Android View similar to Google's Youtube app?

I know that Android's Youtube app is not open source, but I pulled apart the apk with apktool and found that they have a class, YoutubeListView used frequently in their app. Is there already an open source implementation of the Youtube Player Activity's title/ fling view/ layout? I know of similar views like Joao Machete's FlingAndScrollViewer, but I need it to be rigge to a title menu and work as smoothly as that on the Youtube app. If there is no open source implementation, either how hard would it be to convince Google to release just that component's source, or to implement it myself?
Thanks
Btw, the footer in this layout is what I am talking about. It has titles like Info & Related videos that can be clicked and it scrolls to them, and it can be scrolled left and right.
I've come to the conclusion that there is no such view. It would be best to make my own custom layout.

Tools for rapid layout/interface creations?

Does anyone know of any tools (besides DroidDraw) that can help me create the basics of my projects a bit quicker? I'm looking for something that will allow me to very quickly generate the XML for my layouts so I don't have to sit there typing like a robot for so long.
Thanks!
However the drag and drop layout design method is not recommended for Android Applications UI designers but there is an Open Source project on Google Code: android-ui-utils , in which you might find something intersiting.
It uses a Firefox addon Pencil to draw and design android layouts and also uses an online "Android Assets Studio" where you can design your custom Icons like:
Launcher icons
List item icons
Menu Icons
Notification icons
You can give up a try here:
http://code.google.com/p/android-ui-utils/
DroidDraw is OK, but the reality is that if you are going to write for Android you are going to want to learn how to write XML layouts from scratch. I remember that XML layouts seemed bizarre when I first started working with the Android SDK, but eventually it starts to make sense.
I read a blog post from a member of the Android team at Google explaining why XML layouts are better than GUI-based layout systems (such as the one included with the iPhone SDK). I can't find the link right now, but basically XML allows for layouts that gracefully scale across devices of radically different sizes and purposes where a GUI-based layout designer often has to be tweaked at best and redone at worst for devices of different sizes.
The official Android Plugin for Eclipse comes with a GUI Editor which supports drag'n'drop of GUI Elements. Not necessarily better than DroidDraw, but maybe you didn't know yet: http://developer.android.com/sdk/eclipse-adt.html

Categories