简体   繁体   English

实现Material Design CrossFadeDrawer

[英]Implement Material Design CrossFadeDrawer

I am trying to implement CrossFadeDraweLayout using https://github.com/mikepenz/CrossfadeDrawerLayout which is basically a subpart of the project under the name Material Drawer available on GitHub. 我正在尝试使用https://github.com/mikepenz/CrossfadeDrawerLayout实现CrossFadeDraweLayout,它基本上是GitHub上名为Material Drawer的项目的子部分。

I have gone through all the code provided and I am not able to import the following libraries 我已经完成了所有提供的代码,但我无法导入以下库

com.mikepenz.materialdrawer.accountswitcher.AccountHeader;
com.mikepenz.materialdrawer.accountswitcher.AccountHeaderBuilder;
com.mikepenz.materialdrawer.util.UIUtils;

Also can anyone explain the point of the custom library that he has added in his app for CrossfadeDrawerlayout 任何人都可以解释他在他的应用程序中为CrossfadeDrawerlayout添加的自定义库的要点

The CrossfadeDrawerLayout is a stand alone library which provides a DrawerLayout with a Crossfade effect. CrossfadeDrawerLayout是一个独立的库,它为DrawerLayout提供了一个Crossfade效果。

To provide a great example the sample app uses the MaterialDrawer library to provide the normal full drawer view, and the mini drawer view. 为了提供一个很好的示例,示例应用程序使用MaterialDrawer库来提供正常的完整抽屉视图和迷你抽屉视图。

If you need a drawer in your project I highly recommend to also use the MaterialDrawer . 如果您的项目中需要抽屉,我强烈建议您也使用MaterialDrawer Just add the gradle dependency and you are fine. 只需添加gradle依赖项就可以了。

In the case you don't need a Drawer which contains items, and have your own views, you can just drop out the references and use the CrossfadeDrawerLayout as you would do with a normal DrawerLayout 如果您不需要包含项目的Drawer ,并拥有自己的视图,您可以删除引用并使用CrossfadeDrawerLayout就像使用普通的DrawerLayout

You can then just get the reference to the CrossfadeDrawerLayout as you would normally do: 然后,您可以像通常那样获取对CrossfadeDrawerLayout的引用:

CrossfadeDrawerLayout drawer = (CrossfadeDrawerLayout) findViewById(R.id.crossfadeDrawer);

And after this use the CrossfadeDrawerLayout specific APIs to modify it 然后使用CrossfadeDrawerLayout特定的API来修改它

//set the max width (1000 is just a sample number)
drawer.setMaxWidthPx(1000);

//add the small view
drawer.getSmallView().addView(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM