Set XML attribute programmatically if no setter is available



I use a lib project which views I want to create programmatically, not via XML. When creating its layout via XML, I need to set an id for which there is no setter available in Java. Is there any chance to create this view with all its attributes in Java?


Example:



<de.libproject.View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
lib:loadImages="true"
lib:emptyView="true"
lib:imageId="15696" />


As I said, there are no setters like view.enableEmptyView() or view.setImageId().


No comments:

Post a Comment