Fixed API version issue

This commit is contained in:
Akash Yadav
2021-12-09 16:27:59 +05:30
parent 5350fc58d2
commit 819bb36e51
3 changed files with 19 additions and 4 deletions
@@ -33,3 +33,16 @@ We use reflection to automatically create an adapter when inflating a view.
For example, if ```android.widget.Button``` instance is being created, we could simply create an adapter instance using reflection by getting the package name and simple name of the widget.
See ```XMLLayoutInflater#onCreateAttributeAdapter(View)```.
### Precautions
- Make sure you correctly spell the file names. As you might already know, file names are case sensitive.
- Some methods (or even classes) are not available for earlier versions of Android. The classes or methods you're using must be compatible with API 24.
You could also check if you can use a method. Some methods are already implemented in ViewAttrAdapter so you won't have to rewrite them.
For example:
```java
isApi26() // Android 8 (Oreo)
isApi28() // Android 9 (Pie)
isApi29() // Android 10 (Q)
isApi30() // Android 11 (R)
```
@@ -81,10 +81,14 @@ public class ProgressBarAttrAdapter extends ViewAttrAdapter {
}
break;
case "minHeight" :
pb.setMinHeight(parseDimension(value, 0, dm, resFinder));
if (isApi29()) {
pb.setMinHeight(parseDimension(value, 0, dm, resFinder));
}
break;
case "minWidth" :
pb.setMinWidth(parseDimension(value, 0, dm, resFinder));
if (isApi29()) {
pb.setMinWidth(parseDimension(value, 0, dm, resFinder));
}
break;
case "progress" :
pb.setProgress(parseInteger(value, 50));
-2
View File
@@ -1,2 +0,0 @@
# SDK Data
These files are taken directly from the Android SDK