Android: four directional navigation

后端 未结 3 545
野趣味
野趣味 2020-12-17 06:44

I\'ve been trying to implement four directional swipe navigation. And I have some questions on how to put things together.

  1. Thinking about using fragments. Will
3条回答
  •  感情败类
    2020-12-17 07:35

    The closest I can think of, is Google Maps and the way they let the user navigate (scroll, fling and wipe) thru the map.

    What you see there, when scrolling around with a slow network, is that they seem to work with a 4x5 grid. So 20 single images that are placed on a grid. And probably one more in each direction off screen.

    You now need to do two things:

    • get touch events to detect, what the user wants to see at which position.

    • place your content on the grid. You can either build the grid as ImageView's on a FrameLayout or as Bitmap's on a SurfaceView. With the latter you have more control over drawing and placement. With the first putting text, buttons and such is easier. Depending on what you want to show you can go with one these approaches.

提交回复
热议问题