程序员

SlidingMenu例子程序

2015-01-15  本文已影响248人  大明白

Sliding Menu的是一种比较新的设置界面或配置界面效果,在主界面左滑或者右滑出现设置界面,能方便的进行各种操作。如 Evernote、Google+、Foursquare等诸多优秀应用都采用了这种界面方案。

准备工作

git clone如下工程
ActionBarSherlock
SlidingMenu

编译Example

1.导入ActionBarSherlock工程,设置为library
2.导入SlidingMenu工程的library和Example,在library工程中引入1中的library,删除工程内的android-support-v4.jar,否则编译出错。
3.修改SlidingMenuLibrary中的代码:

SlidingActivity extends Activity
SlidingFragmentActivity extends FragmentActivity
SlidingPreferenceActivity extends PreferenceActivity

修改以上三个类的基类为如下

SlidingActivity extends SherlockActivity
SlidingFragmentActivity extends SherlockFragmentActivity
SlidingPreferenceActivity extends SherlockPreferenceActivity

官方支持库

这个开源库好久都没有更新了,Google官方提供了这个效果的支持,用DrawerLayout,具体使用方法可以参考这里

The navigation drawer is a panel that displays the app’s main
navigation options on the left edge of the screen. It is hidden
most of the time, but is revealed when the user swipes a finger
from the left edge of the screen or, while at the top level of the
app, the user touches the app icon in the action bar.

上一篇 下一篇

猜你喜欢

热点阅读