includeFontPadding doesn't works in API 21 - android

I'm using the includeFontPadding = false to remove the font spacing in my TextView's and in Android 28(Right) works fine but in Android 21(Left) still with the font padding in the top.
I was checking in the android developers documentation and the setIncludeFontPadding was introduced in API 1.
Do you have an idea what's happening?

Related

How to set color of a TextView's Drawable in XML - for Android API 15?

My app is using minSdkVersion 15 and I would like to set the color of a TextView's drawable using XML.
There is a solution to a similar question, but it requires API 23.
I'm currently changing the drawable color programmatically, but I would rather do it in XML - if it's possible to do what with API 15?

android - How to change the font of the Switch in xml?

I can change the textview's fonts with using android:fontFamily="#font/test2"
but this is not working on switches, so i created a custom style includes font but still no action. Also I tried with android:textAppearance="#font/test2"
still no action. I can change the font just programmatically. How can I change with using xml attributes?
android:fontFamily atribute in xml is not available for API levels below 16.
For API below 16 use app namespace.

Is there any alternatives of letterSpacing attribute for EditText in API level 20 or below

I've added Why my question is not duplicate of this question in Edit Section, Please review..
We use letterSpacing attribute in EditText to define the spacing between letters like .
But as per documentation, This was only introduced in API level 21 or above, If we try to use it in lower API level version, It shows rendering problem directly as in this picture.
Is there any alternatives for letterSpacing to use in EditText before API level 20 ?
Edit
It was marked as duplicate question but what I want to notify is android:textScaleX attribute and android:letterSpacing attribute is different.
Let's take an example by adding these two attributes in EditText
The result of adding android:letterSpacing is
And the result of adding android:textScaleX is
Sorry you couldn't adjust letterSpacing in Api before 21 but you can adjust it if you draw text on Canvas using 2D graphics APIs.

Android Studio Right to Left ListView

I've been trying to make a ListView to work as RTL (Right to Left).
I've added the following line in the ListView and LinearLayout properties:
android:layoutDirection="rtl"
and it still shows the list from left to right.
Any ideas?
Thank you all but I solved it with:
android:textDirection="rtl"
I've added it to the ListView and the layouts, and it worked. Next time you should try considering using this too for RTL layouts.
To take advantage of RTL layout mirroring, simply make the following changes to your app:
Declare in your app manifest that your app supports RTL mirroring.
Specifically, add android:supportsRtl="true" to the <application> element in your manifest file.
Change all of your app's left/right layout properties to new start/end equivalents.
If you are targeting your app to Android 4.2 (the app's
targetSdkVersion or minSdkVersion is 17 or higher), then you should
use start and end instead of left and right. For example,
android:paddingLeft should become android:paddingStart.
If you want your app to work with versions earlier than Android 4.2
(the app's targetSdkVersion or minSdkVersion is 16 or less), then you
should add start and end in addition to left and right. For
example, you’d use both android:paddingLeft and android:paddingStart.
RTL layout support feature is supported on Android 4.2(API level 17) or above only . Please Add android:layout_gravity="left/right" in your parent Layout . And also allow android:textAlignment.
Set minSdkVersion=17
Please read http://developer.android.com/reference/android/view/View.html#attr_android:layoutDirection
This will automatically adjust according to the device locale
android:textDirection="locale"

setCardElevation no effect pre Lollipop

setCardElevation has no effect for me on a 4.4 device - works on 5.0 - but from what I read in the documentation it should work on pre-L - do you have to do something different than:
cardView.setCardElevation(8dp)
Try using this:
cardview.setMaxCardElevation(8);
From the CardView docs:
If you want to change elevation dynamically, you should call setMaxCardElevation(float) when CardView is initialized.

Categories

Resources