我正在尝试在我的应用程序中添加一个导航抽屉。这是代码:
<DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.abcxyz.properprojectdb.MyDrawerActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></FrameLayout>
<ListView
android:layout_width="240dp"
android:layout_height="match_parent"
android:id="@+id/listView"
android:entries="@array/planets"></ListView>
</DrawerLayout>
我无法为 ListView 添加属性 android:layout_gravity。我不知道为什么它不能使用(intellisense 工作完美,但它不会显示 layout_gravity)
我的应用程序在运行时崩溃,但如果我用 LinearLayout 替换 DrawerLayout,应用程序不会崩溃。我猜是因为我没有为 ListView 添加属性 android:layout_gravity。
这是一个快照,显示 layout_gravity 也没有出现在智能感知中