Sliding in android - android

If you have installed most of mediaplayers like files managers like ES File Explores, users that touches the screen and move to left or right, the pages moves to left or right. That is exactly like build in android music player for 2.3, when user next music. How can I implement this?

You can do it by using a ViewPager widget. Note that its part of the compatibility library so it can be used from API4 and above. Otherwise, you could always implement all this manually.
http://developer.android.com/reference/android/support/v4/view/ViewPager.html

You are thinking of the ViewPager widget. This is available in the Android Support Package, as K-ballo described. Titles/tabs are not included by default, however... if you want your pages to have titles or tabs (i.e. the Google Play store), you can check out Jake Wharton's ViewPagerIndicator.

Related

Fragment that expand over another one

I would like to have 2 fragments visible on the same screen, but one of the two can be expanded by clicking or swiping top/bottom the expandable fragment.
I've made some research and I've found this blog article . But unfortunately is written under Xamarin code template and not clearly understandable to do in Java.
I've some ideas about how to do that by clicking but for swiping bottom/top it's a little bit more complex I think.
This image explains well what I would like to do :
You would probably want to use the (open source and free as in Beer) SlidingUpPanel created (and open sourced) by umano. You can clone the project from their official git hub repository.
The 2.2 version of the Umano Android app features a sexy sliding up draggable panel for the currently playing article. This type of a panel is a common pattern also used in the Google Music app and the Rdio app. This is an open source implementation of this component that you are free to take advantage of in your apps. Umano Team <3 Open Source.
An other alternative, more customizable I think can be found here : https://github.com/6wunderkinder/android-sliding-layer-lib for those who want to stick the sliding panel to TOP/LEFT/RIGHT/BOTTOM.
Hope this help to.
Demonstration video

a moving tab in android application

I want to make a moving list appear from the left of the screen of the activity in the android app.
Something like the facebook app shown below :
,,
how can I make something like that in an android app.
Thanks.
This is a very popular UI pattern called a sliding menu / slider. You can search for open source libraries / projects which implement this for you.
Here is the first one I found on google.
This one is useful if you want to support old (pre holo) android devices too. It's an addon to the excellent holoeverywhere library.
And last but not least, take a look at this official pattern by google which also implements the same behavior. The code for creating it is available here.
The concept behind this is that you are taking a screen grab of the current activity and then loading in the menu. Your not actually sliding between activities, your moving the screen shot. Thats a very basic explanation of whats happening.
If you search for slide navigation on github I'm sure you'll find something.

Titanium Mobile: Slide to switch between the views

I am developing a mobile app using Titanium. I came across the Google Plus, Tweetdeck, Market Apps for Android. To switch between the tabs they use the slide gesture. Its like the next view simply slides in based on your swipe/drag. I would also like to add the same kind to behavior for my app I would like to have it work on both Android and iOS platforms. How can I have it?
I have tried Ti.UI.scrollableView. The problems I faced were
The sliding was not as responsive as seen in the above apps.
The view does not move along with the finger drag. It moves after the finger drag is finished.
It seems to take more memory as the application response slows drastically and animations dont appear to be smooth.
Kindly let me know if there is any other alternative to implement this kind of experience in the app.
Thanks!!
What you basically need is a Ti.UI.ScrollableView which implements the native Android ViewPager. Those other Apps are binding their Tabs to the ViewPager. You can't do this with a Ti.UI.TabGroup but you can either use your own Tab views or some other module that provides this functionality like this. You could also have a look at my Alloy widget here - it provides a custom tab-indicator for Ti.UI.ScrollableView (without another module).
For Android you should consider using a third-party library to implement such functionality.
Personally I use PagerSlidingTabStrip which I have found that works really well.

Implementing a HomeScreen-like horizontally scrollable widget?

Most Android devices feature a home screen which you can scroll horizontally by dragging (there're others that have a grid-like 2d scrolling feature too, but I'm only interested in horizontal scrolling).
Could someone shed some light for me on how this might be achieved?
First I was thinking about using a custom ViewFlipper. I could attach proper sliding animations for it, but it's not exactly the same thing. On the home screen, the "amount of sliding" depends on how far you've dragged your finger on the screen. Animations are fire-and-forget things, I can't stop them midway.
Any ideas?
Here's a video about the desired behaviour: http://www.youtube.com/watch?v=UGdWM2TQNSo&feature=player_detailpage#t=104s
You can take a look at the way Android's stock Launcher app does this here: https://android.googlesource.com/platform/packages/apps/Launcher2/+/master/src/com/android/launcher2/Workspace.java
You're primarily interested in the onTouchEvent, onInterceptTouchEvent, and computeScroll methods.
Google released the compatibility pack with some new UI Elements, which you can download via SDK Manager.
put the .jar file located in sdkfolder/extras/compatibility in your build path.
now you can use a class called ViewPager which behaves like the Android Homescreen.
Or, if you are using Eclipse and ADT plugin v12 or higher, just right click your project, choose "Android Tools" and then "add compatibility package".

Youtube style sliding Tab Layout in Android App

The new Youtube app, and the newer version of JuiceDefender, contains a sliding tabbed layout similar to those seen in Windows 7 Phone. This is a UI feature I would like to include in an app I'm am designing but I cannot find any information or tutorials online. Has anyone seen a tutorial on this?
I believe it's implemented as a HorizontalScrollView containing a TabWidget with custom, fixed-width, tab indicator views.
Now, getting the tab content views to be paged horizontally is less easy, and that requires something like adapting Workspace.java in the Launcher.git project in AOSP.
I have found the answer to this question. The Sliding layout I described is a ViewPager, available from the Android Compatibility Package v4, which is available from the SDK installer.
A tutorial for this can be found here :http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/
Edit
An improvement over the Android Compatibility package is the http://actionbarsherlock.com/ an improvement over the support package that adds more Jelly bean style stuff.
I haven't seen a tutorial like this, but you won't be able to do something like this with just the native widgets as they are. You're really looking at implementing your own custom widgets and views, or at the very least wrapping the included widgets with your own code. Maybe a future api will have such features built in, but at this point you're forced to do everything yourself if you want such an interface.

Categories

Resources