简体   繁体   中英

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.

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

The CrossfadeDrawerLayout is a stand alone library which provides a DrawerLayout with a Crossfade effect.

To provide a great example the sample app uses the MaterialDrawer library to provide the normal full drawer view, and the mini drawer view.

If you need a drawer in your project I highly recommend to also use the MaterialDrawer . Just add the gradle dependency and you are fine.

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

You can then just get the reference to the CrossfadeDrawerLayout as you would normally do:

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

And after this use the CrossfadeDrawerLayout specific APIs to modify it

//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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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