Neoh
Neoh

Reputation: 16174

PercentSupportLibrary : Set percentage values in xml?

I want to use different layout width ratios for larger tablet screens. Is there a way to set percentage based (fraction-type) values such as layout_widthPercent and layout_marginStartPercent in dimens.xml?

Upvotes: 4

Views: 1395

Answers (2)

Aaron Preston
Aaron Preston

Reputation: 111

I'm not sure if anyone else has had this problem since 2015 but, you can use a fraction tag:

    <fraction name="dialog_anim_y_scale">14.285571%</fraction>

Upvotes: 1

Neoh
Neoh

Reputation: 16174

I just solved it. The values in dimens.xml will be something like this :

<resources>
    <item name="width_percent" type="dimen">60%</item>
</resources>

Upvotes: 8

Related Questions