Input text field dimension on Android

Hi all,

I’m using an input text field on my app. Next to the text field there is a display.newRect. I set 30 pixel height for both. On iOS the two object appear with the same height but on Android device they have two different height.

Someone can explain to me why? How can I solve this issue? Two object need to have the same height in every device.

Thank you all

These tutorials might be useful for you:

http://coronalabs.com/blog/2014/12/02/tutorial-sizing-text-input-fields/

http://coronalabs.com/blog/2014/12/16/tutorial-new-native-text-input-features/

One is for builds before 2520 and one is for after but both are useful reads.  It’s useful to read them in order.

Rob

Thank you Rob, i read your tutorial but it doesn’t solve my problem.

The problem is that, probably, Android is not able do resize the input field. I set my rect with 30 pixel height  and the input field height too. But when I test the app on android the two object appear with two different height. The rect has been resize and the input field remain with the original size. I want that the two object have the same height. 

This is the way Android works.  The text boxes have more “chrome” around the actual field.  You can make the field the same size, but you end up with a smaller font.

Rob

Hi Rob,

it still doesn’t work. I’m using function native.getScaledFontSize( textField ) from your tutorial.

I set an input text field with 30 pixel height but its appears still smaller then a 30 px height rect. I don’t care about the font size I need just two object with the same height in every device.

Hi Davide,

You should no longer use the functions outlined in Rob’s earlier tutorial. Please use the built-in Corona functions to deal with finding/setting input text/field sizes.

http://coronalabs.com/blog/2014/12/16/tutorial-new-native-text-input-features/

Take care,

Brent

I’m using 2511build so I can’t use the built-in Corona functions to deal with finding/setting input text/field sizes. However I’m not sure that these functions could solve my problem.

The problem is:

  • I set the rect height as 30 px

  • I set the input text field height 30 px

-On iOS the two objects appear with the same height, and I’m very happy.

-On android the input text field appears smaller then the rect. Is the input text field height (on the screen) 30 - “chrome thickness”?

So, if I knew the “chrome” thickness I could set the input text field heigh=30+“chrome thickness”, so that the two objects (the rectangular and the input text field) appear with the same height. 

But i don’t know the chrome thickness and I don’t know if the chrome thickness is the same with any display dimension.

Hi Davide,

Now that Corona SDK is free to all users, can you use a more recent build, especially the 64-bit-enabled build mentioned in this post?

http://coronalabs.com/blog/2015/01/21/update-on-corona-ios-64-bit-support-and-plugins/

Thanks,

Brent

Thank you Brent , Thank you Rob,

with the new build everything works good.

Congratulations for choosing to make Corona SDK free for all users. This will be a breakthrough!

Take care

These tutorials might be useful for you:

http://coronalabs.com/blog/2014/12/02/tutorial-sizing-text-input-fields/

http://coronalabs.com/blog/2014/12/16/tutorial-new-native-text-input-features/

One is for builds before 2520 and one is for after but both are useful reads.  It’s useful to read them in order.

Rob

Thank you Rob, i read your tutorial but it doesn’t solve my problem.

The problem is that, probably, Android is not able do resize the input field. I set my rect with 30 pixel height  and the input field height too. But when I test the app on android the two object appear with two different height. The rect has been resize and the input field remain with the original size. I want that the two object have the same height. 

This is the way Android works.  The text boxes have more “chrome” around the actual field.  You can make the field the same size, but you end up with a smaller font.

Rob

Hi Rob,

it still doesn’t work. I’m using function native.getScaledFontSize( textField ) from your tutorial.

I set an input text field with 30 pixel height but its appears still smaller then a 30 px height rect. I don’t care about the font size I need just two object with the same height in every device.

Hi Davide,

You should no longer use the functions outlined in Rob’s earlier tutorial. Please use the built-in Corona functions to deal with finding/setting input text/field sizes.

http://coronalabs.com/blog/2014/12/16/tutorial-new-native-text-input-features/

Take care,

Brent

I’m using 2511build so I can’t use the built-in Corona functions to deal with finding/setting input text/field sizes. However I’m not sure that these functions could solve my problem.

The problem is:

  • I set the rect height as 30 px

  • I set the input text field height 30 px

-On iOS the two objects appear with the same height, and I’m very happy.

-On android the input text field appears smaller then the rect. Is the input text field height (on the screen) 30 - “chrome thickness”?

So, if I knew the “chrome” thickness I could set the input text field heigh=30+“chrome thickness”, so that the two objects (the rectangular and the input text field) appear with the same height. 

But i don’t know the chrome thickness and I don’t know if the chrome thickness is the same with any display dimension.

Hi Davide,

Now that Corona SDK is free to all users, can you use a more recent build, especially the 64-bit-enabled build mentioned in this post?

http://coronalabs.com/blog/2015/01/21/update-on-corona-ios-64-bit-support-and-plugins/

Thanks,

Brent

Thank you Brent , Thank you Rob,

with the new build everything works good.

Congratulations for choosing to make Corona SDK free for all users. This will be a breakthrough!

Take care