如何很好地缩放适用于 Android 的 TextView 的背景图像 [英] How to nicely scale a background image of a TextView for Android
问题描述
我正在努力为我的 Android 应用扩展 TextView.我想创建气泡"以在对话中显示文本消息,类似于本机 iPhone SMS 对话.
I'm battleing with extending a TextView for my Android app. I'd like to create "bubbles" to display text messages in a conversation, similar to the native iPhone SMS conversations.
有没有办法在不拉伸背景图像的情况下实现背景图像的大小调整?我想要一个单一的背景图像,保留它的角落,但只在定义的区域中拉伸.我认为这应该是可能的,因为我在 SMS 应用程序中见过它,但我不知道如何实现.
Is there a way to implement the resizing of a background image without just stretching it? I'd like to have a single background image that keeps it's corners but get stretched only in defined areas. I think this should be possible because I've seen it in a SMS app, but I wonder how to implement that.
推荐答案
您正在寻找的是 9.patch 图像.请参阅 draw 9 补丁 文档.
What you are looking for is a 9.patch image. See draw 9 patch documentation.
这篇关于如何很好地缩放适用于 Android 的 TextView 的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!