简体   繁体   中英

Android: navigation drawer without xml

Is it possible to create and add to app Navigation Drawer without using xml?
Every example i saw had an additional xml file with layout.
Nowadays i try to initialize this with:

DrawerLayout sidePanel = new DrawerLayout(this);

and then add this sidePanel using View method addView() but it cause exception.
Is it possible to add Navigation Drawer using only java code?

是的,你可以在没有XML的情况下做到这一点,但你仍然需要一个布局来至少保存你需要的导航抽屉

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