Android Question PNG not transparent

kepler

Active Member
Licensed User
Longtime 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
 

DonManfred

Expert
Licensed User
Longtime User
My problem, is that...
... you ALWAYS does not give enough informations. Upload a small project showing the problem (including the transparent png you are talking about)
 
Upvote 0

kepler

Active Member
Licensed User
Longtime 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
 
Upvote 0

kepler

Active Member
Licensed User
Longtime 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
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Add this line:
B4X:
ImageView1.Gravity = Gravity.FILL
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
The reason is the ImageView1 is set to 44dip but the original image is 56x56pixel.
B4X:
Activity.AddView(ImageView1,4dip,4dip,56dip,56dip)
 
Upvote 0

klaus

Expert
Licensed User
Longtime 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!
 
Upvote 0
Top