P Paladium Member Licensed User Longtime User Feb 4, 2011 #1 Hi there, 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: Code: Copy 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. Please help. Thanks to all.... Markus
Hi there, 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: Code: Copy 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. Please help. Thanks to all.... Markus
P Paladium Member Licensed User Longtime User Feb 4, 2011 #2 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: Upvote 0
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:
Erel B4X founder Staff member Licensed User Longtime User Feb 4, 2011 #3 You can create another layout file with the designer and then load it to the ScrollView with: Code: Copy ScrollView1.Panel.LoadLayout("...") Adding an ImageView programatically: Code: Copy 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. Upvote 0
You can create another layout file with the designer and then load it to the ScrollView with: Code: Copy ScrollView1.Panel.LoadLayout("...") Adding an ImageView programatically: Code: Copy 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.
P Paladium Member Licensed User Longtime User Feb 4, 2011 #4 Thanks for the help. Didn't know that I can load a layoutfile in a scrollview, too. Thanks again.:sign0098: Upvote 0
Thanks for the help. Didn't know that I can load a layoutfile in a scrollview, too. Thanks again.:sign0098:
klaus Expert Licensed User Longtime User Feb 4, 2011 #5 Attached you have an example of a ScrollView with images. Best regards. Attachments ImageScrollView.zip ImageScrollView.zip 186.3 KB · Views: 3,725 ImageScrollView.jpg 44.6 KB · Views: 33,683 Upvote 0
P Paladium Member Licensed User Longtime User Feb 6, 2011 #6 Thanks for all your good help!!! Where would you put the Click_event of an imageview in a seperate layout loaded by a scrollview in another activity? Thanks in advance... Markus Upvote 0
Thanks for all your good help!!! Where would you put the Click_event of an imageview in a seperate layout loaded by a scrollview in another activity? Thanks in advance... Markus
klaus Expert Licensed User Longtime User Feb 6, 2011 #7 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 ? Best regards. Upvote 0
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 ? Best regards.
A askez Member Licensed User Longtime User Jul 12, 2012 #8 can i add text left to the picture? Upvote 0
klaus Expert Licensed User Longtime User Jul 12, 2012 #9 Sure you can, add a Label at the left of each image. Best regards. Upvote 0