Android SlidingDrawer from top?

前端 未结 4 1455
野性不改
野性不改 2020-11-27 03:38

Is there any way to make the drawer slide from top to bottom?

4条回答
  •  隐瞒了意图╮
    2020-11-27 04:23

    I was very unsatisfied with the solutions provided here:

    • The Panel class from http://code.google.com/p/android-misc-widgets/ was really unintuitive to use and also had bugs and visual glitches (unusable for productive use) and no docs at all
    • SlidingTray class from http://aniqroid.sileria.com/doc/api/ was nested in a lib needing too much dependency and for me I did not get it to work at all
    • using android:rotation="180" requires API Level 11, and my target is 10.

    (no offense to the respective devs, trying to be objective here)

    So my solution was to extract SlidingTray from this lib http://aniqroid.sileria.com/doc/api/ (by Ahmed Shakil) and refactored it a bit since it had some quirks needed to be used within Ahmed's lib. SlidingTray is based on Androids own SlidingDrawer, so I guess it is stable. My modification consists of 1 class which I called MultipleOrientationSlidingDrawer and you have to add declare-styleables in your attrs.xml. Other than that it has pretty much the same usage as SlidingDrawer with the additional "orientation" attribute..

    Check it out: MultipleOrientationSlidingDrawer (source & example) @ gist

    Here is a usage example (also provided in the gist)

    
            
                
            
    
            
    
                
            
        
    

    Disclaimer: All the credits go to respective dev. I did not test this solution extensivly, it works great with TOP and BOTTOM set in XML. I did not try to use it programmatically.

提交回复
热议问题