Vertical text alignment in a button/label

How about this one buttonBug.apk (5.0 MB)

Nope still not proper

I think we were thinking along the same lines:
@SimpleFunction(description=“CenterText”)
public void CenterText(ButtonBase button){
Button btn = (Button)button.getView();
btn.setIncludeFontPadding(false);
btn.setPaddingRelative(0,0,0,0);
btn.setGravity(Gravity.CENTER);
}

1 Like

Hello @Ken

If you are thinking about the extension for button , then please make it compatible with label also. It would be a great help.
Thanks.

1 Like

Since I don’t have a device that produces this behavior, it is hard to troubleshoot

1 Like

All of the .apks I uploaded had the extension but It’s not working

So is there any solution to this problem of mine? And I am very much sure that this problem isn’t originated today. It should be there since long time. As I also said in my original post :point_down:

Below are Screenshots for this :point_up:

I wander how didn’t anyone noticed this up-till now :thinking:
:slightly_frowning_face: :disappointed:

I’ll look again later but I’m not sure if/when I’ll be successful

1 Like

Actually your font size is to big for the space in button and thereby it cuts of the button at the bottom with 2dp X density(mine is 4)=8px

bild

2 Likes

Thanks for that @Ken . But this is something that related Kodular staff person should look at. Sorry if anyone feels wrong about this. But right now I am feeling helpless as my project has come to stand-still because buttons, labels, etc are one of the basic components of any project and having fault in them ruins your whole project. :slightly_frowning_face:

Nope Boban I have tried with default font size(i.e. 14) also but the result didn’t change.

2 Likes

See this :point_down: @Boban

Now here the font size is 14 and button height and width is 12% and 25% respectively (I guess big enough for font size 14)

1 Like

What happens if you use a .png or other image file instead of font?

1 Like

text → TEXT →

As you can see, html render it like this, slightly below middle…

Edit: even on different browsers it looks different, I see it like in the image below

bild

That would not be the solution!

As I said earlier, even in original post :point_down:

I will provide you details later as it is 3:07 AM here

The same in Win word with some symbols:

1 Like

I was just wondering what would happen, I wasn’t suggesting it as a permanent solution…

1 Like

Another approach: buttonBug4.aia (1.2 KB)

I checked it in Oppo F11 Pro and Asus Zenfone 4(emulator) and it works pretty well as expected.
Will this assure that it will work same in most of the devices out there?

Also what if I tweak the button properties according to my UI? I guess I have to change everything again.
Secondly, is it good to use non-breakable space entity ( )? As after-all it’s a space and it can vary from device-to-device I think (I may be wrong)

Waiting for your input :slightly_smiling_face:

Let’s see what others get on their devices …

buttonBug4.apk (5.0 MB)

1 Like

Xiaomi Mi A3 Android:10