我正在尝试在Android中创建这样的项目列表,除了右上角的橙色丝带外,我几乎可以完成几乎所有内容,我尝试了不同的方法来实现此UI元素,但它们都不适合我。我尝试将文本视图与功能区图像作为背景旋转45º,但功能区的边缘并不是完美的,我也尝试将色带添加为图像视图,并在其上放置文本视图,但确实很难放置色带和文本视图。那么,实现这一目标的最简单和最有效的方法是什么呢?
提前致谢。
I'm trying to create such a list of items in android, I am able to complete almost everything except the orange ribbon on the right top corner, I tried different methods to achieve this UI element but none of them works properly for me. I tried rotating a text view by 45º with the ribbon image as background but the edges of the ribbon weren't perfect I also tried adding the ribbon as an image view and placed a text view on top of that but It was really difficult to place the ribbon and text view like this. So what is the easiest and most efficient way to achieve this?
Thanks in advance.
发布评论
评论(2)
我认为没有支持此类功能的本地Android组件。您可以创建使用路径的自定义视图。这是一个很棒的教程如果您想遵循它。
I don't think there is a native android component that supports such a feature. You can create a custom view making use of the path. Here is a great tutorial if you want to follow it.
将此
textView
放入您的framelayout
/cardView
:要获得最佳外观,请使用
padding
和margin
属性。Put this
TextView
into yourFrameLayout
/CardView
:To achieve best look, play with
padding
andmargin
attributes.