Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android開源--MenuDrawer

Android開源--MenuDrawer

編輯:關於Android編程

開源地址:https://github.com/SimonVT/android-menudrawer

簡介:menudrawer是跟sliderMenu差不多的一種框架,常被應用做設置界面,以menu作為設置菜單,contentView作為詳細頁面的框架,如下圖

\


API詳解:

****************************左邊MenuDrawer***************************************<喎?/kf/ware/vc/" target="_blank" class="keylink">vc3Ryb25nPjxicj4KMS7J6NbD1vfSszxicj4KbWVudURyYXdlcj1NZW51RHJhd2VyLmF0dGFjaCh0aGlzLE1lbnVEcmF3ZXIuTUVOVV9EUkFHX0NPTlRFTlQpOzxicj4KbWVudURyYXdlci5zZXRDb250ZW50VmlldyhSLmxheW91dC5hY3Rpdml0eV9tYWluKTs8YnI+CjIuyejWw01lbnXSsy+437bIPGJyPgptZW51RHJhd2VyLnNldE1lbnVWaWV3KG1MaXN0Vmlldyk7PGJyPgptZW51RHJhd2VyLnNldE1lbnVTaXplKGdldFdpbmRvd01hbmFnZXIoKS5nZXREZWZhdWx0RGlzcGxheSgpLmdldFdpZHRoKCkpOzxicj4KMy7W9y9NZW510rPP4LulzPjXqjxicj4KbWVudURyYXdlci50b2dnbGVNZW51KCk7PGJyPgo0LrnYsdVNZW510rM8YnI+Cm1lbnVEcmF3ZXIuY2xvc2VNZW51KCk7PGJyPgo8YnI+Cjxicj4KNS7T0rHfserKvrXEsaO05rrNu6y2rzo8YnI+CmdldFZpZXcoyejWw1RhZyk6ICB2LnNldFRhZyhSLmlkLm1kQWN0aXZlVmlld1Bvc2l0aW9uLCBwb3NpdGlvbik7PGJyPgpPbkl0ZW1DbGlja0xpc3RlbmVyKMno1sO1scewu+7Uvkl0ZW0pOm1lbnVEcmF3ZXIuc2V0QWN0aXZlVmlldyh2LHBvc2l0aW9uKTs8YnI+Cjxicj4KPGJyPgo2Lrustq/KsSjLotDC1rjKvrHqyr4pPG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QpOzxicj4KMi7Q3rjE1rjKvsb3tcTOu9bDOjxicj4KMSnU2kFuZHJvaWRNYW5pZmVzdC54bWzW0NDeuMTR+cq9PGJyPgphbmRyb2lkOnRoZW1lPQ=="@style/SampleTheme.Right"
2)在theme.xml中修改:

3)在style.xml中修改:



****************************自定義MenuDrawer***************************************
XML:
View層必須是net.simonvt.menudrawer.TopDrawer四種中的一種定義
menu頁的id必須為android:id="@id/mdMenu"
主頁的id必須是android:id="@id/mdContent"
代碼:設置手動模式並設置menu寬/高
menuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
menuDrawer.setMenuSize(50);
定義指示位置:(指示標的顯示得由manifest文件裡面的theme指定)menuDrawer.setActiveView(v);


****************************MenuDrawer+ViewPager***************************************
Tip:1)主頁實現FragmentActivity;
2)在onPageChangeListener中onPageSelected實現:
menuDrawer.setTouchMode(position==0?MenuDrawer.TOUCH_MODE_FULLSCREEN:MenuDrawer.TOUCH_MODE_NONE);



  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved