ImageView 9 补丁可绘制,但不考虑填充线
我已经有了这个 XML 布局。 frame_top_widget_holo 是一个 9 块可绘制对象,底部和右侧有填充线。它的顶部和左侧也有用于拉伸边界的线。 它被设置为背景,有一个可绘制图像设置为源。结果显示两者,但 src 图像与可绘制对象设置的填充重叠。问题是scaleType,所以我怀疑这可能是一个错误。有谁知道如何解决这个问题?
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:scaleType="centerCrop"
android:background="@drawable/frame_top_widget_holo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bigpicture" />
I've got this XML layout. The frame_top_widget_holo is a 9-patch drawable with padding lines on the bottom and right. It also has lines on the top and the left for the stretch bounds.
It's set as the background, there's an image drawable set as the source. The result shows both but the src image overlaps the padding set by the drawable. The problem is the scaleType so I suspect this could be a bug. Does anyone have an idea how to fix this?
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:scaleType="centerCrop"
android:background="@drawable/frame_top_widget_holo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bigpicture" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
android:cropToPadding="true" 解决了这个问题。叹..
android:cropToPadding="true" solves this. Sigh..