How to create an iOS style arrow button in Android?

落爺英雄遲暮 提交于 2019-12-05 04:22:55

问题


I am partial to dual use buttons in iOS, like in the image below:

How can I create these types of buttons in Android? In other words, the entire button must be clickable, the arrow must be right-aligned and the text of the button must be left aligned.

I tried playing with a regular Button widget, but no luck. Do I have to resort to a Table layout (but then the clickability would be lost).


回答1:


You will need customized shape background for the Button

You can find customizing shape here.

Set that background to the Button from xml, and for showing arrow, you will need to add arrow.png to your project drawables.

you will add attribute to button like this:

<Button android:backround="@drawable/cell_background"
android:drawableRight="@drawable/arrow" ...  />


来源:https://stackoverflow.com/questions/8586522/how-to-create-an-ios-style-arrow-button-in-android

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