我有兩個圖像文件:填充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