Open
Description
Issues and steps to reproduce
- define Style for your view element (e.g. TextView):
<style name="style_text_black">
<item name="android:textSize">12</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">8dp</item>
<item name="android:padding">8dp</item>
</style>
-
initialize ContextThemeWrapper to load the style
ContextThemeWrapper themeWrapper = new ContextThemeWrapper(flexbox.getContext(),R.style.style_text_black);
-
Create multiple new Textview instances and add them to FlexboxLayout
for (...) {
TextView text = new TextView(themeWrapper);
text.setText("test");
flexbox.addView(text);
}
Expected behavior
TextView elements appear in the flexbox layout while considering the margins from the applied style.
Observed behavior
Margins applied by a style using ContextThemeWrapper are ignored
I agree that this might be kind of an edge case, but it took me a few minutes of trying and browsing. Finally I ended up adding separate MarginLayoutParams to my Textviews.
Version of the flexbox library
flexbox:0.3.2