[英]How do I prevent images in imageview from being cropped to a square?
I am trying to create a splash screen for my app, but the image keeps getting cropped to a square in the center of the screen. 我正在尝试为我的应用创建启动屏幕,但是图像一直被裁剪为屏幕中心的正方形。 The mockup of the screen in the "Graphical Layout" tab in Eclipse looks good, but when I test it on the emulator or my phone, the image is clipped/cropped to a square in the center of the screen.
Eclipse中“图形布局”选项卡中的屏幕模型看起来不错,但是当我在模拟器或手机上对其进行测试时,图像被裁剪/裁剪为屏幕中心的正方形。
Screenshot from emulator is available here . 模拟器的屏幕截图可在此处获得 。
The code for this is: 的代码是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/digitalorange" />
</LinearLayout>
将android:scaleType="fitCenter"
到您的ImageView
尝试将android:scaleType="fitXY"
到您的ImageView
,看看它是否满足您的要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.