2011-05-02 68 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"/> 
相關問題