【发布时间】:2018-07-09 19:23:24
【问题描述】:
我想使用约束布局来制作我的应用,但我的侧边导航菜单只能使用 DrawerLayout,所以现在我无法将元素放在我想要的位置。
即使图像设置为“wrap_content”,它也是全屏的,并且在我的列表前面,我希望它位于列表上方。
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<ListView
android:id="@+id/lvLista"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/titleDates"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="#B5D5B5"
app:layout_constraintTop_toBottomOf="@+id/titleDates" />
<ImageView
android:id="@+id/titleDates"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
app:srcCompat="@drawable/dias_de_coleta" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:menu="@menu/drawer_menu" />
</android.support.v4.widget.DrawerLayout>
【问题讨论】:
标签: android android-studio listview navigation-drawer drawerlayout