Android Define Match_Parent in Dimens XML

706 views Asked by At

How can i define the match_parent flag in a dimens.xml?

<dimen name="width">match_parent</dimen>

I tried the methods here Value equals to match_parent or fill_parent in dimens.xml? but none work.

Iam using Android > 27 API.

1

There are 1 answers

0
Abdelrahman Hussein On

First create attribs.xml:

<resources>
    <item name="match_parent" type="dimen">-1</item>
</resources>

Second use your dimens:

  <dimen name="account_width">@dimen/match_parent</dimen>