[英]How do I prevent images in imageview from being cropped to a square?
我正在嘗試為我的應用創建啟動屏幕,但是圖像一直被裁剪為屏幕中心的正方形。 Eclipse中“圖形布局”選項卡中的屏幕模型看起來不錯,但是當我在模擬器或手機上對其進行測試時,圖像被裁剪/裁剪為屏幕中心的正方形。
模擬器的屏幕截圖可在此處獲得 。
的代碼是:
<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.