Android Question PNG not transparent

kepler

Active Member
Licensed User
Good afternoon,

I'm really confused with a small detail.

I've created a panel with a color. Inside of it, I've placed an Image View, with Color set to transparent.
In this last one, I load a PNG image, a rounded icon, where the out borders are transparent.

My problem, is that these borders appear white, instead of the color of the panel...

Ok...what am I doing wrong? Can someone point me out the error?

Kind regards,

Kepler
 

kepler

Active Member
Licensed User
I'm sorry - I was out of town, without wifi...

That's not true Don. But, here's a piece of the code:

B4X:
Sub Globals
    Dim pnl2, pnlMain1 As Panel
    Dim Label1 As Label   
    Dim ImageView1 As ImageView
    Dim label2 As Label
    Dim StrUtil2 As StringUtils
End Sub

    pnl2.Initialize("")
    pnl2.color = Colors.Red
    ImageView1.Initialize("Back")
    ImageView1.Color = Colors.Red
    ImageView1.Bitmap = LoadBitmap(File.DirAssets,"back.png")
    Activity.AddView(pnl2,0,0,100%x,52dip)
    Activity.AddView(ImageView1,4dip,4dip,44dip,44dip)
Kind regards,

Kepler
 

kepler

Active Member
Licensed User
My god... I've posted the main problem - the project is too big!

BUT...Wonder had a point. Photoshop is assuming the image to have a transparent ground. Not true.
I transformed it into a bitmap in coreldraw and exported it as png. That worked...

I can seem to able to understand why photoshop doesn't do the same...I've been working with this program for ages.

Well...these are mysterious ways...

Kind regards,

Kepler
 

Peter Simpson

Expert
Licensed User
Here try this:
B4X:
'Hmm
    pnl2.Initialize("")
    pnl2.color = Colors.Red
    ImageView1.Initialize("Back")
    ImageView1.Color = Colors.red
    ImageView1.Bitmap = LoadBitmap(File.DirAssets,"back.png")
    Activity.AddView(pnl2, 0, 0, 100%x, 60dip)
    pnl2.AddView(ImageView1, 2dip, 2dip, -1, 56dip)
 

aeric

Well-Known Member
Licensed User
Add this line:
B4X:
ImageView1.Gravity = Gravity.FILL
 

aeric

Well-Known Member
Licensed User
The reason is the ImageView1 is set to 44dip but the original image is 56x56pixel.
B4X:
Activity.AddView(ImageView1,4dip,4dip,56dip,56dip)
 

klaus

Expert
Licensed User
My god... I've posted the main problem - the project is too big!
Are you sure ?
Mostly, the problem is not where YOU think but somewhere else.
If you had posted a small project showing the problem you would have got a solution much faster, instead of needing the helpers try to guess what you could have done wrong!
 
Top