我有两个图像文件:填充ImageView的筛选,同时保持纵横比
- 320dpi 768x1280
- 480dpi 1080×1920
我把每帧图像的xhdpi和xxhdpi可绘制的文件夹我的项目。我试图让这两个图像适当缩放,并填充屏幕没有任何空格。
我的XML代码如下:
<RelativeLayout 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.vax.gamurs.LandingPage"
android:background="#ffffffff"
android:orientation="vertical"
>
<ImageView
android:id="@+id/LandingBack"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/background"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
我越来越空白双方的的Nexus 4和Nexus 5的侧面怎样消除空白,并具有图像填充屏幕,同时保持长宽比?
由于图像的宽高比与屏幕的宽高比不同,所以不能。您的选择是在边框上留有空白或裁剪图像。 – GreyBeardedGeek 2014-09-26 02:47:04
@GreyBeardedGeek我应该使用什么样的比例来确保屏幕被填满? – 2014-09-26 02:54:19
取决于设备。没有一个通用长宽比。 – GreyBeardedGeek 2014-09-26 10:04:37