0

我按照 github 上的说明在我的应用程序中由 adamrocker 实现了 simple-side-drawer:

https://github.com/adamrocker/simple-side-drawer

我的应用程序中的代码:

//SLIDE
private SimpleSideDrawer mNav;

mNav = new SimpleSideDrawer(this);
mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple);
findViewById(R.id.slidemenu).setOnClickListener(new OnClickListener() {
        @Override 
        public void onClick(View v) {

            mNav.toggleLeftDrawer();

        }

});

这是“activity_behind_left_simple”的 xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/leftBehindMenuScroll"
android:background="@drawable/lavagna" >

<LinearLayout

    style="@style/behindMenuScrollContent"
    android:layout_height="match_parent"
    android:gravity="center_vertical"
    android:paddingTop="25dp" >

    <TextView
        android:id="@+id/ciao"
        style="@style/behindMenuItemTitle"
        android:gravity="center"
        android:textStyle="italic"
        android:layout_width="fill_parent"
        android:text="General"
        android:textColor="#000000" />

    <Button
        android:id="@+id/matrix"
        android:background="@drawable/but_ok"
        android:textColor="#ffffff"
        style="@style/behindMenuItemLabel"
        android:layout_width="203dp"
        android:layout_height="40dp"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:text="Rate"/>

简单的侧抽屉工作正常,但我想添加一个滚动效果。我怎样才能做到这一点?

4

1 回答 1

0

如果您想要滚动效果,请考虑SlidingMenu开源项目。如果需要,您可以在Play Store上进行演示,但我过去使用过它并取得了很好的成功。

至于使用内置的 Android NavigationDrawer,我相信它已添加到Android 支持库中,因此如果您想采用该方法,可以将其包含在内以实现向后兼容性。

于 2013-12-12T22:14:59.420 回答