Anyone knows how to get the text of any component like textview, button, or edit text with it is current font style.
My issue is that I am getting a normal text with text view.getText() but I want to text with the custom font which I have applied with Typeface.
Thanks in advance
Share your code and what you have done until now in your thread, if you get error include it to your post. Here guide for asking in SO Guide Ask in SO
Related
I want to put html codes on buttons as text in my android application and style them.
For ex: I want to create a help button and put "❔" as text to it.
Below is the code I have written in the activity.
Button btHelp=((Button) findViewById(R.id.btHelp));
btHelp.setText(Html.fromHtml("❔"));
But if I want to change the color of it. I tried by giving span and font in the above statement but it is not applying.
Can you please let me know how to give the colors for this. Also let me know if there is any better way to do so.
Thanks,
If you want to change text color, simply use:
btnHelp.setTextColor(Color.parseColor("#FF0000"));
or
btnHelp.setTextColor(Color.RED);
or
btnHelp.setTextColor(getResources().getColor(R.color.red));
But that won't work with emojis like your White Question Mark Ornament. If you want to change that question mark color, you will have to make a drawable file with button drawables (png) that have that question mark with the color you want. You can do that from photoshop or any other program.
I am using floatlabelededittext in my application. My requirement is to set 2 different fonts for hint and text. Is it possible? Then how?
To have 2 different fonts for text and hint you need to use custom TypefaceSpan.
Set a font to a text by using usual setTypeface method
Set a font to a hint by using SpannableString
I already answered to that question Android EditText hint uses the same font that the EditText has
You can also keep the same font and change the hint's size and style independently. To know how, please, see my answer here
I don't think it is possible right now. But if you look at the source code of floatlabeledittext here https://github.com/wrapp/floatlabelededittext/blob/master/library/src/com/wrapp/floatlabelededittext/FloatLabeledEditText.java you see that it will be easy to add such feature.
All you need to do is to use setTypeface on the hint label mHintTextView.
I'm trying to find a way to format EditText in an Android app that I'm planning to create.
When I created a example project to do this, all there is are plain text multiline edit text etc. There isn't really a specific EditText for rich text formatting. For instance in windows there is RichTextBox. Here thw developer can set styles such as bold,Italics underline etc. by selecting part of the text and styling it.
I'm wondering how I can achieve this in Android development. Can someone shed some light on this, would be greatly appreciated!
i'm new to android programming, i've styled buttons and textfield in web application using stylesheet, how can we do that in andoid, can anyone please tell me how to create a edittext like as shown below image in android.
how can we style a edittext in android.
I suggest to use a Image as background for EditText. I don't believe this can be done in XML.
Ok my first question is:
Is there a way to change the font on everything in my app? I mean to put for ex the font x.ttf to be the default font for all the buttons,listviews,for everything that is in my app? And if yes,how?
And my second question:
If that is not possible,then please tell me how to change the font on the Tab widget...
Thanks
Still There is no way to change the font for a complete application. All You can do is for Text Views create custom Text View and override the font method. Then you can use the customized text view rather than using the default text view.
This is the way I used the font Helvetica for My app.