Background
I found that style attributes do not work in merge tags, either apply the attributes separately, or apply the style.
Known Solutions
Apply style attributes to the tag using the layout. For example, include tags and custom tags.
Just don't use merge.
Programmatically apply styling.
However, I am looking for the best solutions.
Why?
This is dirty. I have to apply style attributes every time I use a layout. I do this as a separate layout because they are designed to be reused.
I intentionally use the merge tag, as they must be immediate children of the parent layout. For example, the tags are children of LinearLayout. I apply layout_width = "0dp" and layout_weight = "1" so that they are evenly distributed in the parent layout.
Reason # 2 plus tags are generated programmatically. This way I can only apply programmatic style. The service requires ugly and extra effort.
purpose
Satisfactory workaround (s).
XML tags to illustrate purpose
<merge xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CustomStyle">
</merge>
and
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
</merge>
Both of the above tags are not framed.
Gavin source
share