0

In my app, I am using an image. I do not want the width of image to exceed the width of the screen in any screen size of any density. How to achieve that and what will be issues as I am using only one image for all android densities instead of images of different resolutions?

4

1 回答 1

0

试试这个,但你需要为每个分辨率调整大小的图像

hdpi、ldpi、mdpi 和 xdpi 分辨率

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/title_bar"
    android:gravity="center_vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/desc"
        android:src="@drawable/YourPicSource" />

</RelativeLayout>
于 2012-08-10T10:45:13.310 回答