This question might be so so simple but difficult for me as a beginner. I am developing an Android app by java. So There is a TextView.
How can I add some style to it. Like changing its colour, font and etc ??
This question might be so so simple but difficult for me as a beginner. I am developing an Android app by java. So There is a TextView.
How can I add some style to it. Like changing its colour, font and etc ??
This will change the color from xml:
<TextView
android:layout_width="wrap_content"
android:layout_height"wrap_content"
android:textColor="#123123"
/>
Changing font is a little bit more in depth. Put your desired font file into the assets folder of your project and use the setTypeface()
method of TextView. That has been covered in a previous question: How to change the font on the TextView?
Alright, Here is the documentation of TextView. There are basically two ways to style the text view using xml and in java code. Here is the relevent xml attributes:
android:textColor
android:textColorHighlight
android:textColorHint
android:textSize
And so on. On code it would look something like this:
TextView tv = (TextView) findViewById(R.id.tv);
tv.setTextColor(Color.BLACK);