When setting the colors for e.g. a TextView you can use the settextcolor from either a color or resource. void android.widget.TextView.setTextColor(int color) public void setTextColor (int color) Sets the text color for all the states (normal, selected, focused) to be this color. There are several ways to do this. To set the colors from your resource you
Tag: textview
Android SetTextSize From Dimen
Setting the TextSize of your TextView from a dimension resource might not work at first. When setting make sure to use the getResource() text.setTextSize(getResources().getDimension(R.dimen.textsize)); dimens.xml <?xml version=”1.0″ encoding=”utf-8″?> <resources> <dimen name=”textsize”>24sp</dimen> </resources>
Use Custom Fonts In Android Application
Applying a custom font to a TextView in your Android Application can be done in a few step. First get the desired fonts, either in Truetype ttf or OpenType otf format. Place the file in the assets folder in the root of your application. Now in your main Activity file apply the font to your TextView like this in