0
我已經創建自定義圖像,我將它設置在佈局的底部:ImageView的不完美使用Android的Nexus 6:layout_alignParentBottom =「真」
<?xml version="1.0" encoding="utf-8"?>
<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">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/btn_1"/>
</RelativeLayout>
它適用於較小的設備,但不與關係6及以上: 我有抽拉-MDPI,HDPI,xhdpi,xxhdpi,xxxhdpi根據圖像尺寸:
360*174
540*261
720*347
1080*521
1440*676
它在Nexus 6和Nexus上左,右側間隙7,9,10沒有被重新 - 大小?有什麼像xxxxhdpi和xxxxxhdpi?我怎樣才能使它工作?我非常感謝任何幫助。
這是唯一的方法是什麼?或者當我在nexus上使用相同的圖像時,圖像會被拉長9,10 ??我可以看到, android:layout_width =「match_parent」正在拉伸圖像。有什麼辦法可以用wrap_content來做到嗎? – jason
@jason它會伸出,但保持長寬比,如果你使用'adjustViewBounds'&'android:scaleType =「centerCrop」' - 否則你將不得不提供圖像爲每個手機的大小或儘可能最大,這是不可能的(或理想) – Sharj