我正在制作一个具有导航抽屉的应用程序.我的电脑无法运行AVD仿真器.即使AVD很小,我也等了好几个小时才启动.话虽这么说,我不得不依靠
Android Studio设计师来看看应用程序的外观.在创建导航抽屉活动时,有什么方法可以切换它在设计器上打开吗?
解决方法
我发现你可以添加工具:openDrawer =“start”到你的DrawerLayout.
像这样:
像这样:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout android:id="@+id/drawer"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:openDrawer="start">
<!-- your content include -->
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/drawer"/>
</android.support.v4.widget.DrawerLayout>
演示:
不是很完美,但这已经足够了!