Decimal number support in percentage value

We can set component’s width and height by percentage like ‘87%’.
But if we enter decimal number like ‘87.235%’, then an error occurs.

Sometimes I have to set exact value to the width and height so I want decimal number support in percentage value setting.

Add this percentage value from the block, don’t from design section.

2 Likes

No, that doesn’t change anything. The percentage width can only be changed using integers.

grafik

3 Likes

You have to remember that width and height of a screen is a discrete value (pixels). In reality you can’t set the exact value of width or height, cause you can’t have any decimal of pixel being displayed.

You can always make your own calculations. Get Width of the screen, multiply it by the percent value you want and round it to integer.

I don’t know if it’s normal behaviour across android app frameworks, but kodular doesn’t show width and height as real pixels. If the smartphone screen resolution is 1920x1080 kodular shorten it to 600x800 (just an example). So there’s a chance you can have your Width and Height as decimal.

1 Like

Please don’t post misleading information.

Kodular does not shorten the height and width values. Kodular displays them in dpi values.

Look at this, then maybe you understand:

1 Like

What is misleading? :joy: Isn’t the 1080 (real amount of horizontal pixels of my phone) less than 392 (value calculated by kodular - width). Yes, it is. I doubt there are many screen nowadays on android phones which would make possible to reverse that dependency.

Your post is much more misleading. DPI value unit is dots (pixels) per inch. Width or height units are just pixels not DPI values. Simple math.

The Android system helps you achieve density independence by providing density-independent pixels (dp or dip) as a unit of measurement that you should use instead of pixels (px).

That’s the value you were probably talking about and that’s the value kodular probably use.