Is it possible to set constraint layout properties in a style?

Viewed 1086

When I set the below constraint layout properties within the activity's xml source I get the expected outcome, but when I set them within a style, the set values don't get processed at all.

<style name="vrm_entry_number_button" parent="@android:style/Widget.Button">
    <item name="android:layout_margin">7dp</item>
    <item name="android:background">#496587</item>
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_height">0dp</item>

    <item name="app:layout_constraintHeight_default">percent</item>
    <item name="app:layout_constraintHeight_percent">0.90</item>
    <item name="app:layout_constraintWidth_default">percent</item>
    <item name="app:layout_constraintWidth_percent">0.10</item>
</style>

What could this be down to and is there an alternative?

1 Answers

Do as below and it should work.

<style name="vrm_entry_number_button" parent="@android:style/Widget.Button">
    <item name="layout_constraintHeight_default">percent</item>
    <item name="layout_constraintHeight_percent">0.90</item>
    <item name="layout_constraintWidth_default">percent</item>
    <item name="layout_constraintWidth_percent">0.10</item>
</style>
Related