How do you make native.newTextField transparent if object.hasBackground doesnt work

Hi everyone
 
I am currently building a login page with Corona and I have a field:

local userName = native.newTextField(display.contentCenterX, display.contentCenterY, display.contentWidth - 250, 100)

userName:setTextColor(0,0,0)

userName.hasBackground = false

userName.placeholder = “Username”

However the userName.hasBackground = false does not make the field transparent.

Is there a work around for this currently?

Thanks everyone :slight_smile:

What devices have you tested on?

This may not work in the simulator.

Also, always be sure to give us the bare essentials:

  • Corona SDK Version you’re using: ex 2017.3030
  • Where you’re running (Windows Sim, OS X Sim, device(s))

Sorry. Only started with Corona today. Getting into it.

I tried it on the Sim, I used 2 Samsung devices (Only ones I have access to) with the app installed.

Both devices are running android version 6.0.1 (Marshmallow)

Corona SDK is 2016.2992. 

I am also using the Windows sim, as well as an iOS sim. (I use Nox Player on my PC)

** Update: This works for me.  See my next post **

@malevolent

Can you run this basic example and try it on your device?

-- Draw red background local cx = display.contentCenterX local cy = display.contentCenterY local rect = display.newRect( cx,cy, 320, 480 ) rect:setFillColor( 1, 0, 0 ) -- Text field with transparent background local textField = native.newTextField( 30, 140, 260, 100 ) textField.x = cx textField.y = cy textField:setTextColor( 0.8, 0.8, 0.8 ) textField.hasBackground = false textField.text = "Hello, world!"

If this fails to work on your device, I’d file a bug here: https://developer.coronalabs.com/content/bug-submission

Hi.  I just tested this and got it to work with this setup:

Here is the APK if you want to try my build:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/02/transparent_textfield/test.apk

What devices have you tested on?

This may not work in the simulator.

Also, always be sure to give us the bare essentials:

  • Corona SDK Version you’re using: ex 2017.3030
  • Where you’re running (Windows Sim, OS X Sim, device(s))

Sorry. Only started with Corona today. Getting into it.

I tried it on the Sim, I used 2 Samsung devices (Only ones I have access to) with the app installed.

Both devices are running android version 6.0.1 (Marshmallow)

Corona SDK is 2016.2992. 

I am also using the Windows sim, as well as an iOS sim. (I use Nox Player on my PC)

** Update: This works for me.  See my next post **

@malevolent

Can you run this basic example and try it on your device?

-- Draw red background local cx = display.contentCenterX local cy = display.contentCenterY local rect = display.newRect( cx,cy, 320, 480 ) rect:setFillColor( 1, 0, 0 ) -- Text field with transparent background local textField = native.newTextField( 30, 140, 260, 100 ) textField.x = cx textField.y = cy textField:setTextColor( 0.8, 0.8, 0.8 ) textField.hasBackground = false textField.text = "Hello, world!"

If this fails to work on your device, I’d file a bug here: https://developer.coronalabs.com/content/bug-submission

Hi.  I just tested this and got it to work with this setup:

Here is the APK if you want to try my build:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/02/transparent_textfield/test.apk