如何做一个按钮,背景图像和底部的文字在黑色的背景 [英] How to do a button with a background image and bottom text on a black background

查看:170
本文介绍了如何做一个按钮,背景图像和底部的文字在黑色的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要与背景图像做的按钮。结果
Furthemore,在按键的底部我要穿上黑色背景的文本。

I want to a do button with a background image.
Furthemore, at the bottom of the button I want to put a text on black background.

例如:

是否有可能做到这一点?如果是这样,怎么样?

Is it possible to do that? If so, how?

推荐答案

这是可能的。并通过使用单一的TextView没有任何其他控制。结果
请注意,您可以使用一个TextView,就好像它是一个按钮。

It's possible. And by using a single TextView without any other controls.
Note that you can use a TextView as if it was a Button.

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#f000"
    android:drawableTop="@drawable/your_picture"
    android:drawablePadding="4dp"
    android:padding="4dp"
    android:gravity="center"
    android:textSize="16sp"
    android:textStyle="bold"
    android:textColor="#ffff"
    android:text="TEXT"
/>

这篇关于如何做一个按钮,背景图像和底部的文字在黑色的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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