How can I change the font color, size and 开发者_如何学Gobutton color from a Java file in Eclipse, not from an XML file?
For font size you can write it as
tv.setTextSize(20.0f);
For font color you can write it as
tv.setTextColor(Color.BLUE);
For button background color you can write it as
btn.setBackgroundColor(Color.CYAN);
button.setTextColor(Color.WHITE);
button.setBackgroundColor(Color.BLUE);
In the "Inherited XML Attributes
" paragraph of the official documentation you can see either XML attributes (that you can change from XML) or related methods (which you can use in your Java code).
Others already posted answers on how to do it in Java, but I guess these could help you as well.
How to do it in XML:
Font Styling
Button Styling --Link changed.
精彩评论