How can I create text style like google snapseed - android

How can I create text style like google snapseed.
Like this 👉
google snapseed text style

For Achieving this style you need to use font family used by the app you are following and also use text styles like bold, italic etc. By using this methodology you can easily achieve your goal.

Related

Text styles used in Settings app for titles and subtitles

which text styles are used for the titles and subtitles in the Settings app? I tried using the following, but none of these produced the same result.
Title text
android:textAppearance="?android:titleTextAppearance"
android:textAppearance="?attr/title"
Subtitle text
android:textAppearance="?android:subtitleTextAppearance"
android:textAppearance="?attr/subtitle"
Text style is often not enough to achieve a particular style, you often need to set color too. In this case, I suspect they use Google Material Components styles. It's hard to judge the appropriate font size here given your font scale, but here's what I think they use:
Title
android:textAppearance="?textAppearanceBody1"
Subtitle
android:textAppearance="?textAppearanceBody2"
android:textColor="#color/material_on_background_emphasis_medium"
They also use a special font.

How do I add bold to a custom font family then use it for strings?

I read on Stack Overflow how to create a custom bold font and a regular one:
How to create custom font family with bold font
But I'm struggling to understand how to implement this in my strings. Ordinarily you simply use <b></b> to make text bold, but this doesn't seem to work with my custom fonts. All the text remains the same.
I know that you have tried adding the bolded font to a font family, but it hasn't worked. You can try one of the ways below. It will work even if you do import a TTF font.
One way you can do it is in strings.xml
You can create a new string and then add the b to bold it like this:
<string name="my_string"><b> My String</b></string>
You will need to create one for each string that you want to bold.
Then in your layout file, you can set the android:text to one of the strings from strings.xml and you can set the android:fontFamilyto the TTF font.
You can also bold it programmatically using the SpannableString in Java. Check this article to see how to bold programmatically.
Hope it helps!

How to set font weight as light, regular in Android

I have 3 text views.
I need to set their weight as Light, Regular and Condensed.
Can someone help me on how to achieve this in Android?
Use android:textStyle on a TextView to set the text style like bold, italic or normal.
Here is an example of a TextView with a bold text style:
<TextView
android:id="#+id/hello_world"
android:text="hello world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"/>
If you want to use light or condensed, you will have to change your font. You can do it like this:
android:fontFamily="sans-serif-light"
For more information about fonts, please also look at the following answer Valid values for android:fontFamily and what they map to?
You can only show a TextView as Light, Regular and Condensed if the font that you're referencing allows those styles.
For example, if you import a font into your project and it doesn't have Light or Condensed, I don't think it's (dare I say) possible to make the text appear with that style in your TextView. If you are importing your own font, work with it programmatically e.g. In your activity declare a global TextView:
private TextView tv;
Then in onCreate(), reference the fontfile you save in /assets:
Typeface someFontName-condensed = Typeface.createFromAsset(getAssets(), "assets/NameOfFont-condensed.ttf");
tv = (TextView) findViewById(R.id.myTextViewId);
tv.setTypeface(someFontName-condensed);
Notice that I imported the condensed version of my font file (as .ttf), not as a packaged font .ttc. You can bring in various style versions of a font, but you should bring them in as individual .ttf files instead of one packaged file because you will want to reference the specific style .ttf.
However, if you're using a system font that allows you to reference various styles from your xml, see what they say here:
Valid values for android:fontFamily and what they map to?
As they say, for something like Roboto, you'll use the fontFamily.

How to make TextView bold using Fontinator library?

I'm using Fontinator library for custom fonts in android. The documentation says:
use splited fonts without android:textStyle!
But if I want to make text bold, how it can be done?
Thanks.
Splited fonts mean a font with multiple files like this:
My-font-bold.otf
My-font-regular.otf
For Bold TextViews you have to use My-font-bold.otf and at normal TextViews My-font-regular.otf
If you have only one font file you can use textStyle!

Glass GDK:Change Color of Static/ Immersion Cards

I am trying to change the color of the text on a static/immersion card related to medical alerts. Such that an allergy is shown in red and bold colors and is easily noticeable.
Is there a way to do this in Glass GDK as the card.SetText() method just takes a String as its parameter and the card is given a layout before.
The GDK Card class does not have functionality to alter the color of text, reference here: https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/Card
However, you can alter text color in your style. Add a line in res/values/styles.xml within your <style> object
<item name="android:textColor">#00FF00</item>
More information on styles and themes here: http://developer.android.com/guide/topics/ui/themes.html
For those who need a solution to this
Make your modifications to the textview in the layout and then set that text to the card as-
card.setText((TextView).getText());

Categories

Resources