我该如何更改
NavigationView
中标题视图的高度?我有以下xml代码:activity_main.xml
<android.support.v4.widget.DrawerLayout
android:id="@+id/dlDrawerContainer"
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"
android:fitsSystemWindows="true"
tools:context=".activity.MainActivity"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- Some data -->
<!-- Drawer -->
<android.support.design.widget.NavigationView
android:fitsSystemWindows="true"
android:id="@+id/nvNavigation"
android:layout_width="wrap_content"
android:maxWidth="400dp"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/navigation_header"/>
</android.support.v4.widget.DrawerLayout>
navigation_header.xml
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxWidth="400dp"
android:maxHeight="100dp"
android:scaleType="matrix"/>
但是NavigationView
忽略了所有的尺寸属性,显示一个带有默认大小的标题。该如何解决?
ImageView
中使用wrap_content
?它与NavigationView
不兼容。我的ImageView
填充了最大父级高度。 - Denis Sologub