How to set a handle button in slider content in android?

前端 未结 3 1571
别跟我提以往
别跟我提以往 2021-01-05 23:26

I am working with android.I had used slider library in my application.

Now I want to add a button to handle the slide activity,so I can swipe contents along with bu

3条回答
  •  心在旅途
    2021-01-05 23:49

    If your main concern is adding your image on Layout then you can do some thing like that ..

    Step(1) Use RelativeLayout as your parent.

    Step(2) For your image view use like this ..

    
    

    Step(3) Now get id of this image view in your java class and put setOnClickListener to it. Now on click simply put your defined code to close and open. Make sure to put a check on it that is drawer open then close drawer and if drawer closed then open drawer.

    Else than this I will suggest you to use ActionBar NavigationDrawer for same .. It is very handy to use.

    I have performed same stuff using Navigation Drawer in one of my project .. It is working like charm.

    Hope it helps..

    EDIT

    If you are using ActionBar NavigationDrawer or anything else then your preferred layout should look like this ..

    
    
    
        
    
            
    
                
    
                    
    
                
    
                
    
    
    
            
    
    
    
    
            
    
        
    
    
    

    Just copy and paste this layout in fresh XML file.. and see how it looks like ..

    More over this I will suggest you to have a look on this tutorial .. http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/

    Hope it helps!

提交回复
热议问题