简体   繁体   English

如何创建带有白色背景,带有三角形箭头的灰色边框的布局-Android

[英]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.

相关问题 在白色背景上将白色图像显示为灰色:Android - Showing white image as grey on white background: Android Android 布局和图像按钮和灰色边框 - Android Layout and Image Buttons and Grey Border android actionbar背景颜色是灰色而不是白色 - android actionbar background color is grey instead of white 为什么当我创建这个新的位图时其背景是深灰色? 如何将其设置为布局背景的相同颜色? - Why when I create this new Bitmap its background is dark grey? How can I set it to the same color of the layout background? 如何获取线性布局的边框而不会丢失布局的当前背景 - How do I get a border of a Linear Layout without losing my current background for the layout 如何在Android中创建此布局 - How do I create this layout in android 如何在Android中创建半透明灰色教程叠加层? - How do I create the semi-transparent grey tutorial overlay in Android? 在Android Image Asset Studio中删除灰色和白色方格背景 - Removing Grey and White Chequered background in Android Image Asset Studio android为白色时,为什么图像显示为浅灰色背景? - Why images are displayed with light grey background, when it has white android? 如何创建带边框和透明背景的按钮 android - How to create a button with border and transparent background android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM