android 9-patch图形在图像视图中不缩放 [英] android 9-patch graphic doesn't scale in image view

查看:203
本文介绍了android 9-patch图形在图像视图中不缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

<LinearLayout android:id="@+id/LinearLayout01"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:orientation="horizontal">
    <ImageView android:layout_height="wrap_content"
        android:layout_width="wrap_content" android:id="@+id/ImageView01"
        android:src="@drawable/phone80"></ImageView>
    <ImageView android:id="@+id/ImageView02"
        android:layout_height="wrap_content" android:src="@drawable/underline"
        android:layout_width="fill_parent" android:layout_gravity="fill_vertical|fill_horizontal"></ImageView>
</LinearLayout>

第一张图片是固定尺寸的图片,根本不应缩放。它的右侧图像应水平缩放到最大空间。源指向有效的.9.png文件。不幸的是,它总是只显示其原始大小。我必须设置什么属性? ImageView是否是正确的对象?

The first image is a fixed size image which shouldn't scale at all. The image right of it should scale horizontally to the maximum space. The source points to a valid .9.png file. Unfortunatly it always only shows up in its original size. What property to I have to set? Is ImageView the right object at all?

谢谢,
A。

Thanks, A.

推荐答案

使用 android:background 代替。如果它只是一个下划线,你可以使用查看而不是 ImageView 。至于填充屏幕的其余部分,您可能想要使用 TableLayout

Use android:background instead. And if it is just an underline, you can use a View and not an ImageView. As for filling the remainder of the screen, you may want to use a TableLayout instead.

此外,请确保你的9补丁是正确的。 1px边必须是黑色。 #000

Also, make sure your 9-patch is correct. The 1px sides must be black. #000

这篇关于android 9-patch图形在图像视图中不缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆