导航抽屉(menu​​drawer)安卓5(棒棒糖)风格棒棒糖、抽屉、风格、drawer

2023-09-13 02:29:50 作者:乏味

我用在我的项目(​​这个menudrawer库:https://github.com/SimonVT/android-menudrawer).

I'm using menudrawer library in my project (this one: https://github.com/SimonVT/android-menudrawer).

我更新我的应用程序与API21(安卓5棒棒堂)和材料设计兼容。当你使用这个库API21 menudrawer的图标看起来不错。

I'm updating my app to be compatible with API21 (Android 5 Lollipop) and Material Design. When you use this library with API21 menudrawer icon looks bad.

我想实现转变,您可以在新的Play商店(新menudrawer图标转变为箭头)看到。

I want to achieve transition you can see in the new Play Store (new menudrawer icon transition to arrow).

什么是做到这一点的最好方法是什么?是否有可能与此库?我想目前唯一的解决方法就是自定义绘制。但是,也许我可以使用本机可绘制某种方式?

What's the best way to do that? Is it possible with this library? The only solution I'm thinking at the moment is custom drawable. But maybe I can use native drawable some way?

推荐答案

确定。我花了几个小时,新的API,我认为最适合我将改写由LIB我的抽屉里,以本土DrawerLayout。

OK. I spent few hours with new API and I think that the best for me will be rewriting my drawer from lib to native DrawerLayout.

但也许这将是有人用类似的问题非常有用。我创建的测试项目DrawerLayout。(Android的工作室 - >新建项目与menudrawer)

But maybe this will be useful for someone with similar problem. I've created test project with DrawerLayout (Android Studio -> New Project with menudrawer).

然后,我看到了同样的问题。错误的图标。如果你想看到奇特的动画和良好的图标为Android 5.0,确保您使用的是:

And then I saw the same problem. Wrong icon. If you want to see fancy animation and good icon for Android 5.0 make sure you are using:

import android.support.**v7**.app.ActionBarDrawerToggle;

请注意在V7。默认情况下片段类有V4导入,然后你就看不到好的图标。

Take note on v7. By default Fragment class has v4 import and then you won't see good icon.

另一件事。更改为V7之后你需要修复的 ActionBarDrawerToggle 函数新的构造函数。就是这样。你会看到新的抽屉图标。

Another thing. After changing to v7 you need to fix ActionBarDrawerToggle function to new constructor. And that's it. You'll see new drawer icon.