Cara membuat Android ImageView pada B4A

Create B4A Project

Go to Designer, add Image View
 add-view-image-view.png
Generate member
 
this will add
Sub Globals
 'These global variables will be redeclared each time the activity is created.
 'These variables can only be accessed from this module.

 Private ImageView1 As ImageView
End Sub
Sub ImageView1_Click
 
End Sub

Sub ImageView1_LongClick
 
End Sub
save layout and load it
Sub Activity_Create(FirstTime As Boolean)
 'Do not forget to load the layout file created with the visual designer. For example:
 Activity.LoadLayout("Layout1")

End Sub
Add image file 
  
 
add your code
Sub Activity_Create(FirstTime As Boolean)
 'Do not forget to load the layout file created with the visual designer. For example:
 Activity.LoadLayout("Layout1")
 ImageView1.Bitmap = LoadBitmap(File.DirAssets, "hardware.png")
 ImageView1.Tag=File.DirAssets &  "hardware.png"
End Sub

Sub ImageView1_Click
 Log ("You Clicked " & ImageView1.Tag)
End Sub

Sub ImageView1_LongClick
 Log ("You have Long Clicked " & ImageView1.Tag)
End Sub

Komentar