SetCompoundDrawableTintList for Android < 5 - android

I am trying to change the color of of an EditText to something at runtime (the color is also calculated at runtime).
SetCompoundDrawableTintList seems to do the trick. But it is only available starting from API Level 23.
Can I somehow archive the same effect for API Level < 23? Note that I want to set the color at runtime and do not know them in advance.

Related

Android: Fixed-width numbers being shown (incorrectly) in API 29 and up

I've tried so many ways to dive into this issue but can't find a fix. Has anyone had something similar?
On phones with API 29 and up, Android is showing our font with tabular (i.e. fixed-width/monospaced) numbers as a default. On API 28 and lower, the (correct/desired) proportional numbers are displayed.
To see what I mean, look at the 1's in the following two images:
What we want (and what we see on API <= 28):
What we're seeing on API >= 29:
I've tried every version I can of setting both/either fontFeatureSettings and/or fontVariationSettings--using all combinations of tnum (or tnum 0) and pnum (or pnum 1)--to no avail.
Any thoughts? This has driven me crazy all day.

MpAndroidChart bug: Line chart fill color on pre API 21 devices

I have found this problem:
The fill color does not follow the data.
This is the method that causes problem in my pre lollipop device.
dataSet.setDrawFilled(true);
In a device with api 21+ all works.
Code:
LineDataSet dataSet = new LineDataSet(yVals, "");
dataSet.setDrawFilled(true);
dataSet.setFillAlpha(255);
dataSet.setFillColor(ctx.getResources().getColor(R.color.blue_primary_color));
If there is a workaround until the fix please let me know it because it's really ugly to see the chart without a Fill color.
EDIT:
I've tried and it works also in emulator with API 15.
The problem happen in my real samsung 4 mini with android 4.4.2.
Add the following line(worked for me):
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
{
mChart.setHardwareAccelerationEnabled(false);
}
See https://github.com/PhilJay/MPAndroidChart/issues/1100
Here they talk about performance:https://github.com/PhilJay/MPAndroidChart/issues/1189
Use dataSet.setFillFormatter to set a custom fill.

Change the new material Progressbar rotation speed

I don't seem to find a way to change the speed of the ProgressBar.
On devices with Kitkat and earlier the older ProgressBar is changing it's speed according to the indeterminateDuration attribut and it works. But on Lollipop, the new material ProgressBar is not being affected.
Do you know how it could be done?
Thanks!
You can use my library ProgressBarLP for your purpose. You can change the duration of the animation through which you can increase or decrease its speed. The attribute to change would be progressCycleDuration. The support is only from API 11 though.

TextButton padding changing with Android version

I have been developing an app over the past few months getting ready for publication. Everything was looking just perfect. I was doing a few things with text in buttons - using my own 9-patch button backgrounds, changing the default font, repositioning textbuttons with setX() and setY() etc. I had some big buttons and smaller ones. Some were a tight fit amongst other objects on the screen, but it all worked, the buttons looked perfect on a variety of tablets and phones.
Then I remembered one last thing on my todo list which wast to change the android:minSdkVersion in my manifest from 8 up to 11. I needed to do this because the setX and setY methods are only available on android 3.0 and higher. But as soon as I did this, the text within my buttons was all screwed up. For a start it was white instead of black - easily fixed. But also the padding round the text was completely different. Buttons were now overlapping each other and looking unbalanced in a variety of ways.
So my question now is this: Is there any way to say "this software must only run on Android 3.0 (api 11) and above" AND "let all the text button characteristics be set to whatever that were with api level 8".
I have no idea why such things would happen - but it's better to just support the older platforms if you can help it. For example, if the only thing keeping you from using API 8+ is the setX() and setY() methods, you can use ViewHelper in the NineOldAndroids project to do this and support the lower API. For example:
ViewHelper.setX(myView, myXValue);
ViewHelper.setY(myView, myYValue);

Actionbar.getHeight() returning different values between API 16 and 17

I need to set a View's topMargin by the Actionbar height so it's visible under the Actionbar. I do this in my onCreateOptionsMenu, thinking the Actionbar is drawn at that point. My app targets API 14 and above only.
Running an emulator with API 17, getHeight() returns a good value of 96dp. But running the same code on an emulator with API 16, a height of zero is returned, likely because it hasn't been drawn yet.
Why would there be a difference between the two APIs?
Read it from:
?android:attr/actionBarSize
Check this post for more information:
What is the size of ActionBar in pixels?

Categories

Resources