-->

How to make a swipe view screens without tab layou

2019-06-11 10:37发布

问题:

I am trying to figure out how to make a swipe view without a tab layout.

In the figure above, 1. I want to make a swipe view that can navigate page left and right. 2. Icon 1 is a global menu that needed to be there all the time while swipping. 3. Icon 3 is a bottom bar. How can I make like that way?

Any kind of suggestions and tutorial links would be appreciated. Thanks in advance.

回答1:

i don't have any links for the same,but still i will tell you the very simple logic to create:

1.First remove the title bar using

 this.requestWindowFeature(Window.FEATURE_NO_TITLE);

2.Use the following Structure

 <RelativeLayout> 
    <ViewPager android:layout_height="fill_parent"
                android:layout_width="fill_parent"> //full screen

        <RelativeLayout android:id="@+id/header"> -->for header
          android:layout_alignParentTop="true"
        </RelativeLayout> 

         <RelativeLayout> -->for inicators
          android:below="@+id/header"
        </RelativeLayout>

        <RelativeLayout> --> for footer
         android:layout_alignParentBottom="true"
        </RelativeLayout>

    </ViewPager>        
</RelativeLayout> 

3.now make the images for header and footer and set as background.
4.for view pager indicator go Through This Post.just download it and import in your eclipse and set as a lib in your project. how to use circle pager indicator Check My Answer.

and you are done now!!



回答2:

You can simply use for example a ViewPager as explained in the official documentation because it's not mandatory to have tabs.

http://developer.android.com/training/animation/screen-slide.html

There's a full example available in that link.

If you need also to display dots for your slides, you can take advantage of this library as pointed out by other users: http://viewpagerindicator.com/



回答3:

Check this library I think this is what you need and you can customize it as per your needs

https://github.com/pakerfeldt/android-viewflow