4

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?

Neoh
  • 15,906
  • 14
  • 66
  • 78

2 Answers2

8

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

<resources>
    <item name="width_percent" type="dimen">60%</item>
</resources>
Neoh
  • 15,906
  • 14
  • 66
  • 78
1

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>
Aaron Preston
  • 111
  • 1
  • 5