PNG alpha

rainersnookh

Member
Licensed User
Longtime User
I have a problem when using a png that fade from white to transparent.

I'm trying to achieve a fade instead of cutting off longer titles in my scrollview.

As you can see in the attachment the fade is more gray than transparent.
I have marked the placement of the png with orange. The gray part is where it fades from white to transparent, otherwise it's 100% white.

I get the same result on the emulator and the phone.

any ideas?
 

Attachments

  • shot.jpg
    shot.jpg
    35.1 KB · Views: 246

rainersnookh

Member
Licensed User
Longtime User
Here it is.

I've tried to save it using the ctrl+alt+shift +s and the regular save as png in PS.
 

Attachments

  • end.png
    end.png
    2.8 KB · Views: 397
Upvote 0

rainersnookh

Member
Licensed User
Longtime User
Alrighty, zipped the png.

Just FYI, I've tried with a brand new project and adding a imageview with the faded png onto a white activity and get the same result.
 

Attachments

  • end.zip
    243 bytes · Views: 221
Upvote 0

JogiDroid

Member
Licensed User
Longtime User
Please zip the image before uploading it. The current image seems like a white box.

It was a white box with some alpha slide.. nothing wrong when I checked it out with Gimp, color was solid and alpha ok too..
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can achieve the desired effect with a GradientDrawable:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.Color = Colors.White
    Dim lbl As Label
    lbl.Initialize("")
    lbl.TextColor = Colors.Black
    lbl.Text = "skdjfhskjd fhksj"
    lbl.TextSize = 20
    Activity.AddView(lbl, 0, 10dip, 300dip, 50dip)
    Dim iv As ImageView
    iv.Initialize("")
    Dim gd As GradientDrawable
    gd.Initialize("LEFT_RIGHT", Array As Int(Colors.ARGB(150, 255, 255, 255), Colors.White))
    iv.Background = gd
    Activity.AddView(iv, 40dip, 10dip, 100dip, 100dip)
End Sub
20110329_1.png
 
Upvote 0
Top