开发者

Resizing an Imageview

I'm searching for few days and I can't find the answer. I'm trying to resize an Image View through 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>

Any idea how to resize it ? It looks like this: http://i55.tinyp开发者_StackOverflow社区ic.com/2h3u4hh.png


If you would like a specific size, you can specify that size via XML by using density independent pixels. On a mdpi screen, 1 dp = 1 pixel, on all screens 100dp is roughly equal to 1 inch.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜