Imageview size problem

bazp

Member
Licensed User
Longtime User
I am trying to make imageview buttons larger through code. I changed the the value 80 to 380 on the addview line with no success. I tried the height and width code with no luck. Any help would be great.

B4X:
For i = 0 To 7
   
 Dim bn As ImageView 
 
 bn.Initialize("ButtonPress")
     
 bn.Enabled = True
 bn.Tag = i

 Dim letter As String
 
 letter=rnx(i)
  
 bn.Bitmap = LoadBitmap(File.DirAssets, lez(i) & ".png")
 panel1.AddView(bn, OffsetX, OffsetY, 80 ,80)
 
  'bn.Width=200
 'bn.Height=200
  
next
 

derez

Expert
Licensed User
Longtime User
Two problems:
1. you should declare an array of imageviews,
B4X:
dim bn(8) as imageview
before the loop starts, and inside the loop initialize each
B4X:
bn(i).initialize("ButtonPress")
. This way you will have to check the sender in the event sub ButtobPress_click.
2. Change the values of offsetx and offsety so that the buttons will not be on top of each other.
 
Upvote 0
Top