Android - make an arrow shape with xml

匿名 (未验证) 提交于 2019-12-03 01:18:02

问题:

I want to make a button for my shape like this one

Is there a way to do this with xml ? Like setting some points, in my case I have 5..

回答1:

What you need is to create a shape xml file in your project's drawable-xxx folder and then use this shape as background for a button.

Here is the shape file called arrow_shape.xml:

Then use it as button's background, for example

 

Here is the screenshot:

More info on Layer-List you can find here.

EDIT:

Keep in mind though that I used certain values for the shape's width and height. If you change those you might need to change the values of the top, bottom and right attributes. So, in that case consider using different values in your project's values directory.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!