Text styles used in Settings app for titles and subtitles - android

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.

Related

How can I create text style like google snapseed

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.

How to Create a custom tab layout that mimics the default tab text

I need to create a custom tab layout, but I want the text to mimic the style used in the normal TabLayout.TabView.
To do that, I've set my text appearance to TextAppearance.Design.Tab.
If you take a look at TabLayout itself, you can see that's what TabView's text uses:
mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance, R.style.TextAppearance_Design_Tab);
...
TextViewCompat.setTextAppearance(mTextView, mTabTextAppearance);
However, when my tabs display, I can clearly see the text is not the same. It's very similar, but the default tab looks to be more bold.
What am I doing incorrectly?
The answer was to set the text appearance programmatically. Setting android:textAppearance on the TextView in the XML file doesn't seem to do anything. Setting the text appearance programmatically (like TabLayout.TabView) works.

How to know the font family of default style in notification?

I create my custom view for notification and use TextView instead of Action.
The problem is: I want the TextView to be displayed with default style (as in default notification), but the TextView is displayed in different style.
So I need to know exactly the font-size, font-family of the default style. If I know these values, I can set them as the style of TextView.
Can anybody help me?
Use android:paddingLeft="8dp" for the text SHARE and decrease textSize by 1sp or 2sp.
Basically, the font size used are as follows :
micro : 12sp
small : 14sp
medium : 18sp
large : 22sp

TextView with custom font isn't centered vertically

I need to use a custom font (VAG Rounded, probably not relevant) but the font changes how my TextViews react.
In the image below, you can see the two textviews with a black background. The left one use the custom font, the right one the default system font (Roboto ?). Both of them have the same xml properties and size, but the padding is not the same and more important, the left one isn't centered vartically !
How can I make the TextView draw its content well centered ?
You can try to remove your customs font padding from your text style (styles.xml):
<item name="android:includeFontPadding">false</item>
If this still doesn't work, i would set a general padding in your styles xml.
I think that you have to set android:layout_height="match_parent" and then also android:gravity="center"
then if you post also your source code we can give you more information
I could not change the font, and I wasn't going to edit each character using an editor (I don't even know what I should have done to fix it).
Si I ended up measure the difference with the default font and I added 0.15f * fontSize in the padding top...

what style/attr/drawable for inverse background?

I try to make a ExpandableListView where the group headers are drawn inverse. There is no problem with changing the text color, size etc. via XML. I even found out how to use the system defaults like
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="#android:style/TextAppearance.Medium.Inverse"
/>
But for the background color?! I don't understand why these styles don't include background color information?!
Of course I could use a direct color, but I look for good default background attributes or styles. Like "style/Background.For.TextAppearance.Medium.Inverse" ;-)
What would be a good solution? So that for the dark themed devices I get white/gray, and for the white themed I get black?
Or should I simply use R.color.background_light?
Greetings, Joerg
PS: First question here ;-) Thanx to all the people answering here the last months and years: You great people made it much more easier for me to find a re-entrance in programming after 12 years break ;-)
As you observe, the styles with "TextAppearance" in their name only affect the foreground text attributes of the view. They are appropriate for the android:textAppearance attribute. The styles with "Widget" in their names define all the UI properties and will work in a style attribute, but Android doesn't define a "Widget.TextView.Inverse" style.
When I wanted to display an console-like log as an inverse text view, I used the following XML:
<TextView
android:textAppearance="#style/TextAppearance.AppCompat.Small.Inverse"
android:background="?android:colorForeground"
... />
It uses the theme's foreground color as the background for the view. With a dark theme it displays dark text on white, and in a light theme it displays light text on black.

Categories

Resources