如何改变Android的一个按钮,文字的背景色? [英] How to change text background color of a button in Android?
本文介绍了如何改变Android的一个按钮,文字的背景色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我寻觅了很多,但我还没有找到我想要的。我正打算做的是改变文字的背景色上的一个按钮。我不感兴趣,在改变上点击的颜色。我只是想改变一个按钮上的文字的背景。谢谢你。
I have searched a lot but I haven't found what I want. What I’m planning to do is to change the background colour of text on a button. I’m not interested in changing the colour on click. I just want to change the background of the text on a button. Thank you.
编辑:
这是一个示例。我想改变的黑色,如果可能的。
This is a sample. I want to change the black colour if it possible.
推荐答案
本证的帮助下创建这一点,我已经正确地定位在按钮的TextView来达致这样的AOUT放:
created this with the help of this,i have correctly positioned the textview on button to acheive this kind of aout put:
<Button
android:id="@+id/button1"
android:layout_width="250dp"
android:layout_height="150dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="380dp"
/>
<TextView
android:id="@+id/textView1"
android:layout_width="130dp"
android:layout_height="70dp"
android:layout_marginLeft="80dp"
android:layout_marginTop="420dp"
android:textSize="40dp"
android:text="Text"
android:gravity="center"
android:textColor="#ffff00"
android:background="#000000"/>
这篇关于如何改变Android的一个按钮,文字的背景色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文