我需要幫助。我一直在試圖操縱這一點,但似乎我無法完成這件事。我試圖將圖像放在抽屜佈局上。 我調用標題圖像佈局(header.xml)爲:標題圖片無法正確放置(DrawerLayout)
<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/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/containerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
<android.support.design.widget.NavigationView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
....
app:headerLayout="@layout/header" <!--THIS IS THE HEADER-->
...
</android.support.v4.widget.DrawerLayout>
對於該(header.xm升)構型:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background"
android:layout_marginBottom="0dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Twitter : @Someone important"
android:drawableLeft="@drawable/twitter"
android:layout_marginBottom="0dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" e-mail : [email protected]"
android:drawableLeft="@drawable/email"
/>
</LinearLayout>
我
並試圖減小圖像佈局高度:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="140dp"
android:src="@drawable/background"
android:layout_marginBottom="0dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Twitter : @Someone important"
android:drawableLeft="@drawable/twitter"
android:layout_marginBottom="0dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" e-mail : [email protected]"
android:drawableLeft="@drawable/email"
/>
</LinearLayout>
我把圖像切斷了。
嘗試在標題的XML中添加'android:scaleType =「centerCrop」''''''' – mastrgamr
您的活動使用什麼風格? – uguboz
它似乎navview站在操作欄後面 – uguboz