android 9-patch graphic doesn#39;t scale in image view(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.
推荐答案
使用 android:background 代替.如果它只是一个下划线,你可以使用 View 而不是 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-patch 是正确的.1px 边必须是黑色的.#000
Also, make sure your 9-patch is correct. The 1px sides must be black. #000
这篇关于android 9-patch 图形在图像视图中不缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:android 9-patch 图形在图像视图中不缩放
基础教程推荐
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
