HorizontalScrollView1.Width = 100%x
Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Dim imagesFolder As String : imagesFolder = File.DirRootExternal & "/Images" Dim Bitmaps As List End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim HorizontalScrollView1 As HorizontalScrollView End Sub
Sub Activity_Create(FirstTime As Boolean) If FirstTime Then ' Activity ProgressDialogShow(" ") ' - Bitmaps.Initialize ' Dim files As List ' If File.Exists(imagesFolder, "") = False Then ' ToastMessageShow(" : " & CRLF & imagesFolder, True) Return ' End If files = File.ListFiles(imagesFolder) ' Dim f As String For i = 0 To files.Size - 1 DoEvents ' ' i- . .jpg f = files.Get(i) If f.ToLowerCase.EndsWith(".jpg") Then ' ' ' 50 Dim b As Bitmap b.InitializeSample(imagesFolder,f,350dip,350dip) Bitmaps.Add(b) If Bitmaps.Size > 50 Then Exit End If Next ' ToastMessageShow(" " & Bitmaps.Size & " ", True) ProgressDialogHide ' End If Activity.LoadLayout("main") ' Activity ' HorizontalScrollView1 HorizontalScrollView1.Panel.Width = 350dip* files.Size ' ImageView ' For i = 0 To Bitmaps.Size -1 Dim iv As ImageView : iv.Initialize("") Dim bd As BitmapDrawable bd.Initialize(Bitmaps.Get(i)) iv.Background = bd HorizontalScrollView1.Panel.AddView(iv, 5dip + i * 350dip, 5dip, 340dip, 340dip) Next End Sub
Source: https://habr.com/ru/post/142758/
All Articles