导航抽屉的背景图像大小(配置文件部分 - 第一行)
Background Image Size for Navigation Drawer (Profile Part - First row)
我正在尝试根据 Official Material Design guidelines 设置导航抽屉的样式。一切都在这里定义,尽管第一行的背景图像大小 - 个人资料部分。我拥有的是:
但是正如您所见,图像似乎被拉伸了。我设置如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/mat2" >
<com.blackB.RoundedImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:background="@drawable/icon_default"
android:contentDescription="@string/imageviewContactus"
android:scaleType="centerCrop"
app:riv_border_color="#BDBDBD"
app:riv_border_width="0dip"
app:riv_corner_radius="38dip"
app:riv_mutate_background="true"
app:riv_oval="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="72dp"
android:gravity="left|center">
<TextView
android:id="@+id/counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/title"
android:layout_below="@+id/title"
android:text="Profile completion"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mr.Right"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</RelativeLayout>
</RelativeLayout>
我也尝试过使用 Imageview 作为背景,它仍然会拉伸。截至目前,我的图像规格为 800x600px,与 image used by google in iosched 相同并保存在 drawable-nodpi 中,就像 Google 所做的一样。
我在这里错过了什么吗?请建议。谢谢 :)
mdpi-
width=384 pixels
height=216 pixels
hdpi-
width=576 pixels
height=324 pixels
xhdpi-
width=768 pixels
height=432 pixels
xxhdpi-
width=1152 pixels
height=648 pixels
图片来源= Google 的报亭应用程序,工具=Adobe photoshop 7.0
我正在尝试根据 Official Material Design guidelines 设置导航抽屉的样式。一切都在这里定义,尽管第一行的背景图像大小 - 个人资料部分。我拥有的是:
但是正如您所见,图像似乎被拉伸了。我设置如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/mat2" >
<com.blackB.RoundedImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:background="@drawable/icon_default"
android:contentDescription="@string/imageviewContactus"
android:scaleType="centerCrop"
app:riv_border_color="#BDBDBD"
app:riv_border_width="0dip"
app:riv_corner_radius="38dip"
app:riv_mutate_background="true"
app:riv_oval="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="72dp"
android:gravity="left|center">
<TextView
android:id="@+id/counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/title"
android:layout_below="@+id/title"
android:text="Profile completion"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mr.Right"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</RelativeLayout>
</RelativeLayout>
我也尝试过使用 Imageview 作为背景,它仍然会拉伸。截至目前,我的图像规格为 800x600px,与 image used by google in iosched 相同并保存在 drawable-nodpi 中,就像 Google 所做的一样。
我在这里错过了什么吗?请建议。谢谢 :)
mdpi- width=384 pixels height=216 pixels hdpi- width=576 pixels height=324 pixels xhdpi- width=768 pixels height=432 pixels xxhdpi- width=1152 pixels height=648 pixels
图片来源= Google 的报亭应用程序,工具=Adobe photoshop 7.0