Android: Sliding object without sliding the background

278 views Asked by At

I'm trying to make application. If the button on page 1 is clicked the page goes to page 2 by sliding the page 1 and the background is not sliding too.

I've tried android:detachWallpaper="true" but its not working, it still moves the background. I also have tried using FrameLayout and fragment but there's error when its trying to show messagebox and accessing another class. the error log:

Unable to start activity ComponentInfo{com.example.myfirstapp/com.example.fragment.MainFragment}: java.lang.NullPointerException

Does anyone knows the best solution?

1

There are 1 answers

0
Techfist On

this totally depends upon your UI implementation there is no default guidelines for the same, below are the possible implementation scenarios through which this can be easily achieved.

  1. Framelayout and fragment (you already tried)
  2. ViewFlipper (set background to flipper, and keep flipping different views just like you want)
  3. View Pager (Same as flipper but with adapter support)