I think this snippet from values/styles.xml says it all:
<!-- Style for the label above a button -->
<style name="baseLabel">
<item name="android:gravity">center</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_columnWeight">1</item>
<item name="android:layout_gravity">center_horizontal|fill_horizontal</item>
</style>
And a corresponding entry from layout/main.xml might look like:
<TextView
style="@style/baseLabel" android:text="@string/lr12"
app:layout_row="0"
app:layout_column="1" />
There are no build errors, but the layout_gravity attribute has had no effect. (It works fine if I set it in the layout file: app:layout_gravity="center_horizontal|fill_horizontal
)
You're setting android:layout_gravity
in your style, but app:layout_gravity
in what you say you're setting in the layout file. Those attributes need to match if you want them to do the same thing, so you should be using layout_gravity
and layout_columnWeight
in your style.