带有九个补丁背景的文本视图周围的填充没有视觉效果
我试图创建基于文本视图的类似吐司的控件,并且我发现文本视图的行为非常奇怪,如果它有九个可绘制的补丁作为背景。
这是 xml 定义:
<by.pplware.view.QuickInfo
android:id="@+id/quickinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:padding="20px"
android:textSize="20px"
android:textStyle="bold"
android:typeface="serif"
android:background="#FFFF0000"
/>
这是带有彩色背景的文本视图:
这是具有可绘制背景的文本视图:
据我了解,在 ninepatch 背景的情况下,android 会使填充透明并仅使用可绘制对象作为文本背景。但我想将填充包含到覆盖有 ninepatch 背景的区域中。
这个问题有什么解决办法吗?
Im trying to create toast like control based on textview, and i found very strange behavior of textview in case when it have nine patch drawable as background.
This is xml definition:
<by.pplware.view.QuickInfo
android:id="@+id/quickinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:padding="20px"
android:textSize="20px"
android:textStyle="bold"
android:typeface="serif"
android:background="#FFFF0000"
/>
this is textview with color background:
this is textview with drawable background :
As i understand, in case of ninepatch background android make padding transparent and use drawable only as background for text. But I want to include padding into area covered with ninepatch background.
Is there any solution for this issue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下任一方法:
Try any of these: