0
在我的应用程序中,我正在使用图像。我不希望图像的宽度超过任何密度的任何屏幕尺寸的屏幕宽度。如何实现这一点,什么将是问题,因为我只使用一个图像的所有android密度,而不是不同分辨率的图像?将图像的宽度限制为屏幕宽度
在我的应用程序中,我正在使用图像。我不希望图像的宽度超过任何密度的任何屏幕尺寸的屏幕宽度。如何实现这一点,什么将是问题,因为我只使用一个图像的所有android密度,而不是不同分辨率的图像?将图像的宽度限制为屏幕宽度
试试这个,但你需要一个调整图像的每个分辨率
华电国际,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>
有什么办法避免这种情况?什么“wrap_content”实现? – 2012-08-10 10:53:19
wrap_content被你的真实图像宽度所取代,如果你想在所有的屏幕上改变wrap_content与match_parent或fill_parent我希望能帮助你 – 2012-08-10 10:59:31