Android Question Text On Labels vs Buttons (SOLVED)

Guardian17

Active Member
Licensed User
Longtime User
I have been using a Galaxy S3 smartphone (720x1280 pixels, 305ppi) for my game development for a few years. I recently purchased an LG G4 smartphone (1440x2560 pixels, 538ppi) and noticed that the letters on my self-made QWERTY keyboard keys were getting truncated on the right and bottom. (I made my own keyboard because I need to change the colors of the keys throughout the game).

As a result, I came up with the attached project (see TestLabelAndButton.zip). This App places a label and a button on the screen that are both the same size. It also allows you to change the height, width, text size, and text of both the label and the button, as well as showing some screen metrics.

There is a big difference between how this App appears on my Galaxy S3 (see Screenshot_GalaxyS3.png), and on my LG G4 (see Screenshot_LGG4.png). The label is the top View, and the button is the lower View.

What I am curious about is why there is such a big difference between the label and button as far as how much text can appear on each. As you can see, the "ABC" text fully appears on both the label and button on the GS3 at 100x100 size, but although the full "ABC" text appears on the LG G4 label, just a tiny piece of the "A" appears on the LG G4 button at 100x100.

In a slightly larger set of Views (122x122 -- see Screenshot_LGG4Margins.png), the LG G4 label text looks fine, but only the "A" appears on the button of the same size, with an appreciable top and left margin. Making the Width any smaller starts to cause the right edge of the "A" to be cut away.

My questions are:
1) Why is there a difference between how the text appears on labels and on buttons of the same size?
2) Is there any way to change the metrics of how text appears on buttons (top and left margins)?
 

Attachments

  • TestLabelAndButton.zip
    18.5 KB · Views: 136
  • Screenshot_GalaxyS3.png
    Screenshot_GalaxyS3.png
    66 KB · Views: 159
  • Screenshot_LGG4.png
    Screenshot_LGG4.png
    195.3 KB · Views: 147
  • Screenshot_LGG4Margins.png
    Screenshot_LGG4Margins.png
    196.8 KB · Views: 148

derez

Expert
Licensed User
Longtime User
I guess that the S3 is of android version 4 and the LG4 of version 5 and that is causing everything you see.
Read about the issues of version 5, holo effect etc. in the forum.
 
Upvote 0

Guardian17

Active Member
Licensed User
Longtime User
ABSOLUTELY FANTASTIC!!!! :D

Thanks, Dave O, (and Erel)!! I'd give you TEN "LIKES" if I could!!

That (using the JavaObject to SetPadding) is what I was interested in knowing!!

:D:D:D:D:D

I agree that putting padding settings in the Designer for a button would be a benefit. Not sure why the button padding is set the way it is. If it defaulted to (0,0,0,0), it would save many extra operations.
 
Last edited:
Upvote 0
Top