I have perhaps a dumb question. Can someone tell me how to add an imageview to a scrollview?
I looked at the tutorial, but this isn't general enough.
I put a scrollview on the activity in the designer. I added a lot of images in the designer.
I started:
B4X:
Dim flscroll1 As ScrollView
Dim aa As ImageView
flscroll1.Panel.AddView(aa,20,20,70,50)
aa.Bitmap(????????????(Do not know, added with designer),"a.png")
aa.Gravity = Gravity.CENTER
So, how to easily add manually without the designer imageviews to a scrollview? Just basic things. I need an click-event on each imageview.
Especially I would be happy if someone could help me to load image files into the program. I don't know what the designer does, what I do have to do manually for the scrollview. :sign0085:
You can create another layout file with the designer and then load it to the ScrollView with:
B4X:
ScrollView1.Panel.LoadLayout("...")
Adding an ImageView programatically:
B4X:
Dim IV As ImageView
IV.Initialize("IV")
ScrollView1.Panel.AddView(IV, ...)
IV.SetBackgroundImage(LoadBitmap(File.DirAssets, "1.jpg")) 'Image added with the designer or File manager.
If the other ScrollView is in another activity you must have the ScroolView_Click event in that activity.
But why do you want to have the other ScrollView in another activity, and not keep it in the same activity ?