简体   繁体   English

自定义形状按钮Android

[英]Custom Shape Button Android

I have to address this type of views which has buttons below example. 我必须解决这种类型的视图,其中的示例下方有按钮。 http://www.planet1107.net/blog/custom-shape-uibutton-tutorial/ http://www.planet1107.net/blog/custom-shape-uibutton-tutorial/

It is in the iOS. 它在iOS中。 so is there any way to make it in Android. 所以有什么方法可以在Android中实现。 I also have to give click events on all of those buttons. 我还必须为所有这些按钮提供点击事件。

I would recommend just exporting these custom images to pngs. 我建议仅将这些自定义图像导出为png。 Then adding the pngs to your Android project and simply referencing them in the code or XML. 然后将png添加到您的Android项目中,并简单地在代码或XML中引用它们。 Then on a click event you can simply change the icon to indicate that it has been clicked and if the user clicks on it one more time change it back. 然后,在单击事件中,您可以简单地更改图标以表明它已被单击,如果用户再次单击它,则将其更改回原来的状态。

This will also ensure that the Android images look identical to the iOS ones. 这还将确保Android图像看起来与iOS图像相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM