[英]How do I create a layout w/ a white background, grey border with a triangle arrow - Android
How would I replicate this in Android, my general instinct would be to create a regular layout w/ a border, then have 2 layouts that contain a triangle (one the same color as the border + one that's slightly smaller but white and overlap the two), idk if there's an easier way to do that: 我将如何在Android中复制它,我的一般本能是创建一个带边框的常规布局,然后有2个包含三角形的布局(一种与边框颜色相同,另一种颜色稍小但白色,并且将两者重叠),如果有更简单的方法可以执行以下操作:
You can use 9patch
to achieve something like you wanted. 您可以使用
9patch
实现所需的功能。
The Draw 9-patch tool is a WYSIWYG editor that allows you to create bitmap images that automatically resize to accommodate the contents of the view and the size of the screen.
Draw 9-patch工具是一个WYSIWYG编辑器,它允许您创建位图图像,该位图图像会自动调整大小以适应视图内容和屏幕尺寸。 Selected parts of the image are scaled horizontally or vertically based indicators drawn within the image.
图像的选定部分将根据在图像内绘制的水平或垂直方向的指示器进行缩放。
A complete guideline can be found here : http://developer.android.com/tools/help/draw9patch.html 完整的指南可以在这里找到: http : //developer.android.com/tools/help/draw9patch.html
The easiest way to reach this, is to set the layout background to that image. 最简单的方法是将布局背景设置为该图像。
background="@drawable/template"
Probably you want to have the area out of the "bubble" transparent, so you will need to save it as PNG. 可能您想使该区域不透明,因此您需要将其另存为PNG。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.