Correct way of implementing SlidingDrawer in Android

偶尔善良 提交于 2020-01-13 10:10:52

问题


What is the correct way of implementing Sliding functionality in android?? because android.widget.SlidingDrawer class in android has been deprecated what is the alternative for this?? please help.. Thanks


回答1:


SlidingDrawer class was deprecated in API level 17.This class is not supported anymore. Instead of use Navigation Drawer More info




回答2:


SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen. SlidingDrawer can be used vertically or horizontally. Xml file

 <SlidingDrawer
     android:id="@+id/drawer"
     android:layout_width="match_parent"
     android:layout_height="match_parent"

     android:handle="@+id/handle"
     android:content="@+id/content">

     <ImageView
         android:id="@id/handle"
         android:layout_width="88dip"
         android:layout_height="44dip" />

     <GridView
         android:id="@id/content"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />

 </SlidingDrawer>

The size of the SlidingDrawer defines how much space the content will occupy once slid out so SlidingDrawer should usually use match_parent for both its dimensions. Inside an XML layout, SlidingDrawer must define the id of the handle and of the content:




回答3:


The Sliding Drawer class is deprecated for API level 17 and above. Use Navigation Drawer instead; see the Android design help page as follows:

  • http://developer.android.com/design/patterns/navigation-drawer.html

However, you can still use Sliding Drawer below API level 17. See the following Sliding Drawer example; it's a step by step implementation process, and I bet it will help you:

  • http://www.bogotobogo.com/Android/android9TabWidgetFlipper.php


来源:https://stackoverflow.com/questions/19019315/correct-way-of-implementing-slidingdrawer-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!