侧边菜单栏 android-menudrawer
生活随笔
收集整理的這篇文章主要介紹了
侧边菜单栏 android-menudrawer
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這是github上的一款開源項目,類似于人人網可滑動的側邊菜單欄-----android-menudrawer。
使用方法也很簡單。
1.將下載的包解壓放入你的工作目錄下
2.利用Eclipse通過new-->project...->Android Project from Existing Code,找到項目目錄,
3.導入library和例子。運行例子項目即可了解所有功能并移植到你的項目中。
menudrawer支持菜單在上下左右各個方位,支持動畫效果的定制,比較靈活,在工程項目中也只需幾行代碼就能實現。
//側邊菜單欄?? private?MenuDrawer?mMenuDrawer;private?void?initMenu(){??mMenuDrawer?=?MenuDrawer.attach(this,?MenuDrawer.MENU_DRAG_CONTENT,?Position.LEFT);??mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);??mMenuDrawer.setContentView(R.layout.main);??mMenuDrawer.setMenuView(R.layout.sms_menu);??mMenuDrawer.setDropShadow(R.drawable.shadow);??mMenuDrawer.setDropShadowSize((int)getResources().getDimension(R.dimen.shadow_width));??mMenuDrawer.setMaxAnimationDuration(3000);??mMenuDrawer.setHardwareLayerEnabled(false);??mMenuDrawer.setMenuSize((int)getResources().getDimension(R.dimen.slidingmenu_offset));??}菜單欄陰影樣式dimens.xml
<?xml?version="1.0"?encoding="utf-8"?> <shape?xmlns:android="http://schemas.android.com/apk/res/android"?><gradientandroid:endColor="#33000000"android:centerColor="#11000000"android:startColor="#00000000"?/></shape>菜單欄相關尺寸資源
<resources>??<!--?Default?screen?margins,?per?the?Android?Design?guidelines.?-->??<dimen?name="slidingmenu_offset">200dp</dimen>??<dimen?name="shadow_width">15dp</dimen>??</resources>另外在github上還有一款比較熱門的側邊菜單欄SlidingMenu,左右滑動的菜單效果相差無幾,可惜沒有上下式的菜單欄實現。若無特別需求,SlidingMenu也是不錯的選擇。
<pre></pre>?? <pre></pre>?? <pre></pre>?? <pre></pre>轉載于:https://blog.51cto.com/ribmusic/1610673
總結
以上是生活随笔為你收集整理的侧边菜单栏 android-menudrawer的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 二鸟在林不如一鸟在手
- 下一篇: InputStreamReader 和