0

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

<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

4

1 回答 1

3

如果您想要一个特定的尺寸,您可以通过 XML 使用与密度无关的像素来指定该尺寸。在 mdpi 屏幕上,1 dp = 1 像素,在所有屏幕上 100dp 大致等于 1 英寸。

<ImageView
    android:src="@drawable/iconwide"
    android:id="@+id/imageView1"
    android:layout_width="200dp"
    android:layout_height="50dp"/>
于 2011-05-02T21:33:38.027 回答