I'm designing a native navigation drawer in Android Studio. I can't see the drawer in my preview because it is sitting left of the activity, out of range of the preview. For now I'm using a testlayout.xml file to see my changes, but a lot of times I forget to copy paste them into the right activity. Is there a way to preview the drawer layout?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
To see NavigationView preview add tools namespace to your drawer layout:
then add attribute tools:openDrawer equal to gravity of layout_gravity value of your Navigation view, for example
If you want to be able to preview the drawer layout / navigation bar
If you are following the tutorial at https://developer.android.com/training/implementing-navigation/nav-drawer.html
You can put your listview for the nav drawer in a different xml file in the /layout folder, then include it in the drawer layout xml. Means you can edit it in the drawer_layout file and be able to see it properly
layout/drawer_layout
Then in the navbar
You can use NavigationView to get its preview on AndroidStudio, Its much better and easier to implement then the old NavigationDrawer.
activity_main.xml
Define the menu in navigationmenu.xml place it in menu resource folder:-
And, for getting click events use this:-
Just Add