I asked chatGPT to show me how to have an attribute that can take in a collection of drawable references for my CustomView via xml
here's what it spat out:
for attrs.xml:
<declare-styleable name="CustomView">
<attr name="images" format="reference|reference[]"/>
</declare-styleable>
usage in some xml layout:
<com.example.CustomView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:images="@drawable/icon1,@drawable/icon2,@drawable/icon3" />
retrieval via constructor:
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomView);
int[] imageIds = a.getResourceIdArray(R.styleable.CustomView_images);
a.recycle();
However I am getting the error Can not extract resource from com.android.aaptcompiler.ParsedResource@458c701d, so I am here to ask humbly about how to really get this done (if it's possible)