如何建立在Android中使用iOS风格的箭头按钮?箭头、按钮、风格、Android

由网友(四大金刚芭比)分享简介:我偏在iOS的两用按钮,像下面的图片中:I am partial to dual use buttons in iOS, like in the image below:我怎样才能创建这些类型的按钮在Android的?换句话说,整个按钮一定要点击,箭头必须是右对齐和按钮上的文字必须保持一致。 How can I c...

我偏在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" ...  />
阅读全文

相关推荐

最新文章