图像尺寸在不同的Android手机中变化

时间:2014-05-02 19:03:06

标签: android android-layout bitmap

您好我正在Android中从URL下载位图并将其设置为imageview。奇怪的问题是,在一个Micromax Android手机和索尼中相同的位图看起来很好而且很大,它的尺寸看起来非常小。

enter image description here

即使我将宽度设置为fill_parent

,看到条形码显得非常小

enter image description here

并且在一部手机中看起来很好看,这两款手机都有相同的屏幕宽度。

enter image description here

<LinearLayout
    android:id="@+id/bottomLayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/bottomLayoutofflipicon"
    android:layout_marginLeft="10dip"
    android:layout_marginRight="10dip"
    android:layout_marginTop="10dip"
    android:background="@drawable/rounded_corner2"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="5dip" >

    <ImageView
        android:id="@+id/qrCode"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true" />

    <TextView
        android:id="@+id/barCodevaluetextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

2 个答案:

答案 0 :(得分:1)

ImageView中,将android:layout_width更改为android:layout_width="match_parent"

答案 1 :(得分:0)

只需使用大尺寸drawables修复我的问题,我也使用了scaletype来centerInside。