Tag: textview

Android SetTextColor From Colors

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

Tagged with: , ,

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>

Tagged with: , ,

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.

Tagged with: , , , , ,