如何建立在Android中使用iOS风格的箭头按钮? [英] How to create an iOS style arrow button in Android?

查看:440
本文介绍了如何建立在Android中使用iOS风格的箭头按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我偏在iOS的两用按钮,像下面的图片中:

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

我怎样才能创建这些类型的按钮在Android的?换句话说,整个按钮一定要点击,箭头必须是右对齐和按钮上的文字必须保持一致。

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.

我试着用一个普通按钮控件播放,但没有运气。我必须求助于Table布局(但随后可点击就会丢失)。

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).

推荐答案

您将需要自定义形状背景的按钮

You will need customized shape background for the Button

您可以找到在这里定制的形状。

设置背景的按钮从XML和用于显示的箭头,你将需要添加 arrow.png 到项目可绘制。

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" ...  />

这篇关于如何建立在Android中使用iOS风格的箭头按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆