Nick
Nick

Reputation: 2948

Android Define Match_Parent in Dimens XML

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.

Upvotes: 1

Views: 733

Answers (1)

Abdelrahman Hussein
Abdelrahman Hussein

Reputation: 69

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>

Upvotes: 1

Related Questions