如何使用jfeinstein10的SlidingMenu库更改抽屉指示器?

时间:2014-02-15 10:57:23

标签: android icons slidingmenu slidingdrawer

目前有一个导航抽屉指示箭头,我该如何更改? 这应该是在操作栏或滑动菜单中更改吗?

我试过这个没有运气:

sm.setSelectorDrawable(R.drawable.ic_drawer);
sm.setSelectorEnabled(true);

2 个答案:

答案 0 :(得分:5)

将其添加到styles-v11和v14

  <resources>
        <style name="MyAppTheme" parent="Theme.Sherlock.Light">

            <item name="android:homeAsUpIndicator">@drawable/ic_drawer</item>
            <item name="homeAsUpIndicator">@drawable/ic_drawer</item>
        </style>
    </resources>

用于正常的样式

<resources>
    <style name="MyAppTheme" parent="Theme.Sherlock.Light">
        <item name="homeAsUpIndicator">@drawable/ic_drawer</item>
    </style>
</resources>

答案 1 :(得分:0)

如果您使用滑动菜单作为xml视图,那么您可能已经看过这段代码:

<com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
xmlns:sliding="http://schemas.android.com/apk/res-auto"
android:id="@+id/slidingmenulayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
sliding:viewAbove="@layout/YOUR_ABOVE_VIEW"
sliding:viewBehind="@layout/YOUR_BEHIND_BEHIND"
sliding:touchModeAbove="margin|fullscreen"
sliding:behindOffset="@dimen/YOUR_OFFSET"
sliding:behindWidth="@dimen/YOUR_WIDTH"
sliding:behindScrollScale="@dimen/YOUR_SCALE"
sliding:shadowDrawable="@drawable/YOUR_SHADOW"
sliding:shadowWidth="@dimen/YOUR_SHADOW_WIDTH"
sliding:fadeEnabled="true|false"
sliding:fadeDegree="float"
sliding:selectorEnabled="true|false"
sliding:selectorDrawable="@drawable/YOUR_SELECTOR"/>

给出selectorDrawable,你想为抽屉指示器设置的图像。