How do we create an AttributeSet in Android without xml

308 views Asked by At

I know we can set AttributeSet without creating custom attributes in xml

XmlPullParser parser = resources.getXml(myResource);
AttributeSet attributes = Xml.asAttributeSet(parser);

I want do do something like this

kotlin

val attrs: AttributeSet = AnArray("android:orientation=Horizontal","
   android:layout_height=match_parent")

java

AttributeSet attrs = new AnArray("android:orientation=Horizontal","
   android:layout_height=match_parent")

Is it possible to type an Array and store it as Attribute set?

0

There are 0 answers