0

Please notice the change in the heading and the whole page upon scrolling....one can only understand this question if they might have used windows phone.In the default music player that nokia provides or any other music player on windows 8 phone...when the main screen pops up ,the view looks something similar to the view in android with fragments attached in a view pager,but its a bit different.Upon scrolling between pages, the objects seem to be floating.Thats maybe because the view has three layers. One is the main layer where the content is displayed the other is the background and the third is where the title is written.

the objects in windows music player app move(in horizontal direction) with different velocities(and also different distances). The layer containing the title moves a bit slower,the background a little faster and text, the fastest. I mean if one swaps between views,the text is swapped completely,background is swapped say by 1/3 and the title is swapped say by 1/5.

anyone knows how i can achieve this kind of view??

Ankit Srivastava
  • 280
  • 2
  • 7
  • 24
  • possible duplicate of [How to achieve the view of windows music player app in android?](http://stackoverflow.com/questions/19142541/how-to-achieve-the-view-of-windows-music-player-app-in-android) – Matt Lacey Oct 03 '13 at 10:03
  • @MattLacey i deleted the question..and did u understand the question now?? – Ankit Srivastava Oct 03 '13 at 10:11
  • yes. But don't ask new questions when an original is on hold. Improve the original question. – Matt Lacey Oct 03 '13 at 10:11
  • it wouldn't have got attention then, and can u suggest where to begin with? – Ankit Srivastava Oct 03 '13 at 10:12
  • @AnkitSrivastava, that's what [bounties are for](http://stackoverflow.com/help/bounty). – Bryan Herbst Oct 03 '13 at 19:24
  • You can add an image of what you want to achieve so as to increase your potential answerers. – Nitin Sethi Oct 05 '13 at 14:23
  • yeah, thanx i am going to do that... – Ankit Srivastava Oct 05 '13 at 14:25
  • @NitinSethi please have a look............ – Ankit Srivastava Oct 05 '13 at 14:37
  • I have made such Parallax effect yesterday myself. Here is same effect applied in `ScrollView`, although mine was a bit different. https://github.com/chrisjenx/ParallaxScrollView . Use this technique any way you want. – M-Wajeeh Oct 05 '13 at 14:47
  • Not sure on the efficiency of this but you could possibly try to make three horizontal scroll views that, as the user swipes, you then dynamically shift the other views accordingly? Is there a specific reason why you're trying to replicate a Windows 8 OS in Android OS though? – dsrees Oct 05 '13 at 14:47
  • @M-WaJeEh thnx i will take a look.... – Ankit Srivastava Oct 05 '13 at 14:49
  • @drees its just not about the view......this effect makes the main text or data to look as if it is floating....and that gives a better user experience – Ankit Srivastava Oct 05 '13 at 14:51
  • @M-WaJeEh hey thats really nice,that gave me the basic idea,but i guess i will have to develop my own code if i have to use it for fragments,but if u know an existing code for fragments that would be really useful.. – Ankit Srivastava Oct 05 '13 at 14:59
  • For parallax effect you just need an `ImageView` at background and thats it. You can attach a scrolling listener (in ViewPager or ScrollView) and change the image in ImageView as you like. There is no such thing as developing it for `Fragment`. Fragments will just be placed above that ImageView. – M-Wajeeh Oct 05 '13 at 15:06
  • @M-WaJeEh Hey no effence but have u worked with fragments?? fragments are set up using an adapter and a view pager,and the layout of each fragment is different,which is making me confused how i can use a single instance of an imageview in all the fragments?? – Ankit Srivastava Oct 05 '13 at 15:10
  • i think i should use the image view behind the view pager,thanx .....and put ur code or link so that i can give it the bounty... – Ankit Srivastava Oct 05 '13 at 15:13
  • Lolz, none taken. Its first time I have heard that `Fragment`s are set up using an Adapter. No brother fragment do not require an Adapter but ViewPager does and in ViewPager you will inflate each Fragment .. blah blah... and yes Every fragment has its own Layout. What I am saying is to place an ImageView behind ViewPager in xml and then inflate layout. Fill ViewPager with Fragments and attach a listener on ViewPager and update the ImageView that is behind ViewPager. Do you understand now :)? – M-Wajeeh Oct 05 '13 at 15:18
  • 1
    Oh you figured already. ok, let me post it. – M-Wajeeh Oct 05 '13 at 15:19
  • 1
    Wow cool you are from pakistan :) – Ankit Srivastava Oct 05 '13 at 15:20
  • @M-WaJeEh can u do me a small favour? – Ankit Srivastava Oct 08 '13 at 10:16
  • Well never mind,the internet of my emulator wasn't working properly,but its workingfine now. anyways have you tried freelancer.com? – Ankit Srivastava Oct 08 '13 at 11:57
  • @M-WaJeEh help needed...http://stackoverflow.com/questions/19276340/androidmusic-player-unable-to-start-service-with-null-point-exception – Ankit Srivastava Oct 09 '13 at 15:52

1 Answers1

1

Place an ImageView behind ViewPager and use the same technique used by this guy: https://github.com/chrisjenx/ParallaxScrollView

M-Wajeeh
  • 17,204
  • 10
  • 66
  • 103
  • Wow cool you are from pakistan :) and sorry i can only give u bounty after 22 hours(some stack overflow thing ) – Ankit Srivastava Oct 05 '13 at 15:21
  • Thank, no problem. Yes I am from Pakistan. You are from India? Hows your studies at Jaypee Institute of Information Technology going? :P – M-Wajeeh Oct 05 '13 at 15:25
  • u seem to have worked on xml as well,can u suggest me a few tutorials or e.gs to improve my layouts for android? – Ankit Srivastava Oct 05 '13 at 15:26
  • Haha well not so nice,i code all night and manytimes i skip classes,and they don't teach much useful stuff in college,its just a degree why i am in college,nothing more. – Ankit Srivastava Oct 05 '13 at 15:29
  • Well there are infinite number of samples/examples available on Internet. Why not start with http://www.vogella.com/articles/Android/article.html and http://stackoverflow.com/questions/1840231/open-source-examples-of-well-designed-android-applications and http://blog.interstellr.com/post/39321551640/14-great-android-apps-that-are-also-open-source – M-Wajeeh Oct 05 '13 at 15:30
  • well i wasn't asking for the basic android tutorials,what i meant was how can i make my apps look more beautiful? ( using some xml ) for eg. https://www.youtube.com/watch?v=pPyR0nYUXqc – Ankit Srivastava Oct 05 '13 at 15:34
  • Well there is no hard and fast rule. Look at the images of the app that I am currently working on. It depends on the aesthetic sense of Graphic designer and the your ability to execute them. Look at some some screen shots of our app that is in beta stage now and will be released soon: https://lh6.ggpht.com/RdEOflXEQA33jEMmJ3v1lyv8Z37nBE-EIWZkr-0tbXQdW8pEkDunZfFFSnsRMCjP96s=h900-rw and https://lh5.ggpht.com/VzZ5lTEm-6ztKKM9Hr_VnRfBJ0q4f7PbRV578TR0iSQsNxiC2rWErE8IZ-c66FkEzQ=h900-rw – M-Wajeeh Oct 05 '13 at 15:42