I have the following drawable, called small:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:dither="true"
android:shape="oval"
>
<size
android:height="10dp"
android:width="10dp"
/>
<solid android:color="#FF666666" />
</shape>
I would like to access the height and width defined in size. This is the line that gets the drawable:
val drawable: GradientDrawable = getDrawable(R.drawable.small) as GradientDrawable
GradientDrawable does not seem to have any accessors that provide the size and its fields. Even running in the debugger I see no fields that are set to 10dp. Is there a way to access the size height and width?
from How to access size of Android Drawable
No comments:
Post a Comment