设置的ImageButton文 [英] Set the text in ImageButton

查看:160
本文介绍了设置的ImageButton文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ImageButton的它看起来像这样。

I have a ImageButton which looks like this.

 <ImageButton
            android:id="@+id/ImageButton"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:layout_gravity="center"
            android:layout_marginBottom="6px"
            android:layout_marginRight="3px"
            android:layout_toRightOf="@+id/Logo"
            android:background="@drawable/button_bg_purple"
            android:scaleType="fitStart"
            android:src="@drawable/ImageButton" />


 ImageButton ImgButton= (ImageButton) this.findViewById(R.id.ImageButton);

现在我需要在ImageButton的添加动​​态文本编程,我不能使用按钮。
我该怎么办呢?

Now I need to add a dynamic text in ImageButton programmatically and I cannot use button. How can I do it?

在此先感谢...

推荐答案

的ImageButton 不能包含文本:

选项,你可以尝试

1)使用按钮而不是的ImageButton

2)使用的ImageButton 的TextView 下面显示的文本

2) use ImageButton and TextView below to show text

希望能帮助

这篇关于设置的ImageButton文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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