2011-05-02 108 views
0

我在寻找了几天,我无法找到答案。我正在尝试通过XML调整图像视图的大小。 调整大小的ImageView的

<TableRow android:layout_height="wrap_content" android:id="@+id/header" android:layout_width="match_parent"> <TableLayout android:layout_height="wrap_content" android:id="@+id/logo" android:layout_width="wrap_content" android:layout_weight="1"> <ImageView android:src="@drawable/iconwide" android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent"></ImageView> </TableLayout> <TableLayout android:layout_height="wrap_content" android:id="@+id/user" android:layout_width="wrap_content" android:layout_weight="1"> <TextView android:layout_width="wrap_content" android:text="@string/user" android:layout_height="wrap_content" android:id="@+id/suser" android:layout_weight="1"></TextView> </TableLayout> </TableRow>

不知道如何调整呢?它看起来像这样:http://i55.tinypic.com/2h3u4hh.png

+0

你怎么想它调整?具体尺寸?要成为图像的大小? – 2011-05-02 21:03:05

+0

比方说,一个特定的大小 – Nightbox 2011-05-02 21:12:02

+0

对于特定的尺寸,提供而不是“match_parent”的具体大小。尝试“100dp”layout_height,看看你的想法。 – 2011-05-02 21:33:43

回答

3

如果您想要一个特定的大小,您可以通过使用density independent pixels通过XML指定该大小。上的屏幕MDPI,1个DP = 1个像素,在所有屏幕上100dp大致等于1英寸。

<ImageView 
    android:src="@drawable/iconwide" 
    android:id="@+id/imageView1" 
    android:layout_width="200dp" 
    android:layout_height="50dp"/> 
相关问题