Android 位图上的圆底角?
大家好,裁剪位图底部边框的最佳做法是什么?只需操作位图本身或覆盖可绘制的 alpha 遮罩或...?
整个故事:
我有一个 Listview,它看起来像 iPhone 的分组 UITableView 样式。我想在最后一行显示位图,但现在位图与列表视图单元格的自定义背景可绘制重叠。
提前谢谢!
Hey all, what would be best practice for clipping the bottom borders of a Bitmap? Just manipulate the Bitmap itself or overlay an alpha mask drawable or ...?
The whole story:
I've a Listview which looks like the iPhone's grouped UITableView style. I would like to display a Bitmap in the last row, but for now the Bitmap overlaps my custom background drawable of the Listview cell.
Thx in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
仅供参考:我找到了这个代码片段: http://www.ruibm.com/?p= 184..
在我的例子中,我只希望底角是圆角的,所以我在画布上添加了一个额外的drawRect(高度比drawRoundRect小)。
Fyi: I've found this code snippet: http://www.ruibm.com/?p=184 .
As in my case, I only wanted the bottom corners to be rounded, so I added an additional drawRect (with smaller height than the drawRoundRect) to the canvas.
我想你的答案可以在这里找到: 如何在 Android 中创建带有圆角的 ListView?< /a>
I think your answer can be found here: How do I create a ListView with rounded corners in Android?
我需要做同样的事情 - 但我想在 XML 中正确地完成它,而不是 java 代码。
我已经解释了我在这个问题的答案中所做的事情: Android XML 圆角剪角 。
正是这种遮罩吸引了我——它可以覆盖在任何布局上,而且问题极少。只需修改一个 9Patch 屏蔽文件,即可轻松扩展整个项目,并更改精确的屏蔽。
I needed to do the same thing - but I wanted to do it right in the XML, rather than java code.
I have explained what I did in an answer on this question: Android XML rounded clipped corners.
It was the masking that appealed to me - it can be overlaid over any layout, with minimal problems. Very easy to scale over a whole project, and to change the exact masking, by just modifying one 9Patch masking file.