B4A Library [Library] B4aGridView v3.80



Hi guys, B4AGridView is updated to v3.70.


1: GridView Demo
1: Library
1: PDF Explanations



A big thanks goes to ( Sergey Tarasevich - author of Universal Image Loader )

A thanks is always appreciated.


B4AGridView
Author:
Giuseppe Salvi
Version: 3.7

  • Fields:
    • Default As Typeface
      The default NORMAL typeface object.
    • Default_Bold As Typeface
      The default BOLD typeface object.
    • Monospace As Typeface
      The NORMAL style of the default monospace typeface.
    • Sans_Serif As Typeface
      The NORMAL style of the default sans serif typeface.
    • Serif As Typeface
      The NORMAL style of the default serif typeface.
    • Style_Bold As Int
      The default BOLD style int.
    • Style_Bold_Italic As Int
      The default BOLD ITALIC style int.
    • Style_Italic As Int
      The default ITALIC style int.
    • Style_Normal As Int
      The default NORMAL style int.
    Methods:
    • LoadFontFromAssets (file As String) As Typeface
      Create a new typeface from the specified font data from assets.
    • LoadFontFromFile (file As String) As Typeface
      Create a new typeface from the specified font data from sdcard.

  • Fields:
    • Center As ScaleType
      Center the image in the view, but perform no scaling.
    • Center_Crop As ScaleType
      Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
      will be equal to or larger than the corresponding dimension of the view (minus padding).
    • Center_Inside As ScaleType
      Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
      will be equal to or less than the corresponding dimension of the view (minus padding).
    • Fit_Center As ScaleType
      Scale the image using CENTER.
    • Fit_End As ScaleType
      Scale the image using END.
    • Fit_Start As ScaleType
      Scale the image using START.
    • Fit_XY As ScaleType
      Scale the image using FILL.
    • Matrix As ScaleType
      Scale using the image matrix when drawing.

  • Fields:
    • CARDS As Int
      CARDS Effect = 2
    • CURL As Int
      CURL Effect = 3
    • FADE As Int
      FADE Effect = 12
    • FAN As Int
      FAN Effect = 9
    • FLIP As Int
      FLIP Effect = 5
    • FLY As Int
      FLY Effect = 6
    • GROW As Int
      GROW Effect = 1
    • HELIX As Int
      HELIX Effect = 8
    • PUZZLE As Int
      PUZZLE Effect = 16
    • REVERSE_FLY As Int
      REVERSE_FLY Effect = 7
    • REVERSE_TWIRL As Int
      REVERSE_TWIRL Effect = 15
    • SLIDE_IN As Int
      SLIDE_IN Effect = 14
    • STANDARD As Int
      Standard Effect = 0
    • TILT As Int
      TILT Effect = 10
    • TWIRL As Int
      TWIRL Effect = 13
    • WAVE As Int
      WAVE Effect = 4
    • ZIPPER As Int
      ZIPPER Effect = 11

  • Fields:
    • Text_Bottom_Inside As GravityEnum
      Text Bottom InSide
    • Text_Bottom_OutSide As GravityEnum
      Text Bottom OutSide
    • Text_Center_Inside As GravityEnum
      Text Center InSide
    • Text_Top_Inside As GravityEnum
      Text Top InSide
    • Text_Top_OutSide As GravityEnum
      Text Top OutSide

  • Fields:
    • AUTO_FIT As Int
      Creates as many columns as can fit on screen.
    • NO_STRETCH As Int
      Disables stretching.
    • STRETCH_COLUMN_WIDTH As Int
      Stretches the spacing between columns.
    • STRETCH_SPACING As Int
      Stretches columns.
    • STRETCH_SPACING_UNIFORM As Int
      Stretches the spacing between columns.

  • Fields:
    • Compress_Format_JPG As CompressFormat
      Compression Format JPG
    • Compress_Format_PNG As CompressFormat
      Compression Format PNG

  • PhotoGridView
    Events:
    • ItemClick (Position As Int, Value As Object)
    • ItemLongClick (Position As Int, Value As Object)
    • Ready ( As )
    • ShareItemClick (Value As Object)
    Methods:
    • AddImage (dir As String, file As String)
      Add an image from sdcard or AssetsDir at the end of the GridView
    • AddImageAt (index As Int, dir As String, file As String)
      Add an image from sdcard or AssetsDir to the desired position in the GridView
    • AddImageFromWeb (address As String)
      Add an image from web at the end of the GridView
    • AddImageFromWebAt (index As Int, address As String)
      Add an image from Web to the desired position in the GridView
    • AddThisView
      Adds view to this activity 100%x,100%y
    • ClearDiskCache
      Clears disk cache.
    • ClearMemoryCache
      Clears memory cache
    • DestroyEngine
      Stops ImageLoader and clears current configuration. Use this option on exit app.
    • GetArrayList As List
      Gets array.
    • GetCacheDir As String
      Returns application cache directory. Cache directory will be created on SD card
      <i>("/Android/data/[app_package_name]/cache")</i> if card is mounted and app has appropriate permission. Else -
      Android defines cache directory on device's file system.
      Return type: @return:Cache {@link File directory}.<br />
      <b>NOTE:</b> Can be null in some unpredictable cases (if SD card is unmounted)
    • GetImageListFromAssets (path As String, sort As Boolean) As List
      Get entire list of images stored in assets or sub-folder
      Examples:
      <code>
      Dim lv as ListView
      Dim l as list
      l.Initialize
      lv.Initialize("lv")
      Sub Menu_Click
      Activity.AddView(lv,0,0,100%x,100%y)
      l = GridView.GetImageListFromAssets("Here the Images folder stored in Assets")
      or
      l = GridView.GetImageListFromAssets(File.DirAssets)
      or
      l = GridView.GetImageListFromAssets("")
      For n = 0 To l.Size-1
      lv.AddSingleLine(l.Get(n))
      next
      End Sub
      </code>
    • GetIndividualCacheDir As String
      Returns individual application cache directory (for only image caching from ImageLoader). Cache directory will be
      created on SD card <i>("/Android/data/[app_package_name]/cache/b4AGridview-Images")</i> if card is mounted and app has
      appropriate permission. Else - Android defines cache directory on device's file system.
    • GetItem (position As Int) As String
      Returns Item
      Example:
      i.Bitmap=LoadBitmap("",g.GetItem(Position))
    • GetRealImagePath (filename As String) As String
      Returns the real path of the image
    • GoToWebsite (url As String)
      Go to web site by given an address
      Example:
      GoToWebsite("www.example.com")
      url:
    • Initialize (EventName As String)
      Initialize the object
    • Initialize2 (EventName As String, withCacheName As String)
      Initialize the object and set own cache directory
    • InitializeFromLayout (EventName As String, container As ViewGroup, Layout As String, LayoutID As String)
      Initialize the object from layout
    • PauseEngine
      Pause ImageLoader. All new load and display tasks won't be executed until ImageLoader is resumed.
      Already running tasks are not paused.
    • ResumeEngine
      Resumes waiting load and display tasks
    • SetArrayList (array As ArrayList)
      Sets array.
    • SetText (text As String)
      Sets the string value of the TextView.
    • SetText2 (index As Int, text As String)
      Sets the string value of the TextView.
    • ShareItemsTo (appName As String, item As String, subJect As String, message As String, shareTo As String)
      Share any items to ?
      app: name
      item:
      subJect:
      message:
      shareTo:
    • ShareTextUrlTo (subject As String, text As String, message As String, shareTo As String)
      Share any text to ?
      subject:
      text:
      message:
      shareTo:
    • ShowActionBarToShare (icons() As String)
      Sets the icons on action bar
      Example:
      Dim icons() As String = Array As String("gmail.png","email.png","gmx.png","dropbox.png","facebook.png","twitter.png","telegram.png","line.png")
      icons: as array
    • ShowFromAssets (path As String, sort As Boolean)
      Populate GridView from assets or assets/sub-folder
    • ShowFromBucket (path As String, sort As Boolean)
      Populate GridView from sdcard
    • ShowFromMediaStore (sort As Boolean)
      Populate GridView from media store images
    • ShowFromSdCard (dir As String, path As String, sort As Boolean)
      Populate GridView from sdcard
    • ShowFromWeb (webStrings() As String, sort As Boolean)
      Populate GridView from web
    • StopEngine
      Cancels all running and scheduled display image tasks.
      <b>NOTE:</b> This method doesn't shutdown if you set them.

      ImageLoader still can be used after calling this method.
    • TextBackGroundColor (red As Int, green As Int, blue As Int)
      Sets the background color for this view.
      <b>by default red = 0</b>
      <b>by default green = 0</b>
      <b>by default blue = 0</b>
    • TextColor2 (alpha As Int, red As Int, green As Int, blue As Int)
      Get or Sets Text Color - by default White
    • isPauseOnFling As Boolean
      Whether pause ImageLoader during fling
    • isPauseOnScroll As Boolean
      Whether pause ImageLoader during touch scrolling
    Permissions:
    • android.permission.INTERNET
    • android.permission.READ_EXTERNAL_STORAGE
    • android.permission.WRITE_EXTERNAL_STORAGE
    Properties:
    • CacheInMemory As Boolean [write only]
      Sets whether loaded image will be cached in memory.
    • CacheOnDisk As Boolean [write only]
      Sets whether loaded image will be cached on disk.
    • ColumnWidth As Int
      Get or Sets Specifies the fixed width for each column.
    • CompressFormat As BitmaCompression
      Get or Sets the known formats a bitmap can be compressed into [ JPG or PNG ]Sets the quality of a bitmap, that can be compressed. [ 0 = low -> 100 = high ]
      by default PNG
    • CompressQuality As Int
      Get or Sets the quality of a bitmap, that can be compressed. [ 0 = low -> 100 = high ]
      by default 100
    • DelayBeforeLoading As Int [write only]
      Sets delay time before starting loading task. Default - no delay.
    • FadeInTime As Int [write only]
      Duration of "fade-in" animation (in milliseconds)
      Whether animation should be played if image is loaded from network
      Whether animation should be played if image is loaded from disk cache
      Whether animation should be played if image is loaded from memory cache
    • Friction As Boolean
      Get or Sets the amount of friction applied to flings.
    • Gravity As Int [write only]
      Specifies the gravity within each cell.
    • HorizontalSpacing As Int [write only]
      Defines the default horizontal spacing between columns..
    • ItemHeight As Int
      Get or Sets the the size of the images will be displayed in thumbnail by default size is 480x320
    • ItemWidth As Int
      Get or Sets the the size of the images will be displayed in thumbnail by default size is 480x320
    • Length As Int [read only]
      Returns length
    • LoadFontFromAssets As String [write only]
      Loads a new Typeface from the specified font data.
    • LoadFontFromFile As String [write only]
      Loads a new Typeface from the specified font data.
    • MaxAnimationVelocity As Int
      Get or Sets max animation velocity.
    • NumColumns As Int
      Get or Sets the number of columns in the grid.
    • PauseOnFling As Boolean [write only]
      Whether pause ImageLoader during fling
    • PauseOnScroll As Boolean [write only]
      Whether pause ImageLoader during touch scrolling
    • ProgressBarIndeterminate As Boolean [write only]
      Change the indeterminate mode for this progress bar.
    • ProgressBarVisible As Boolean [write only]
      Set the enabled state of this view. - by default is trueChange the indeterminate mode for this progress bar.
    • RemoveAt As Int [write only]
      Removes the item at the specified location from this list.
    • ResetViewBeforeLoading As Boolean [write only]
      Sets whether image view will be reset before image loading start
    • RoundedBitmap As Boolean [write only]
      Can display bitmap with rounded corners. - by default is false
    • ScaleType As PhotoScaleTypes
      Controls how the image should be resized or moved to match the size of this ImageView.
      by default ScaleTypeFIT_XY
    • ScaleTypeForRounded As ScaleType [write only]
      Controls how the RoundedBitmap should be resized or moved to match the size of this ImageView.
      by default ScaleType.FIT_CENTER
    • Selection As Int
      Get or Sets the currently selected item.
    • SetBorderColor As Int [write only]
      Set the border Color - by default is transparent
    • SetBorderWidth As Int [write only]
      Set the border Width - by default is 0
    • SetCornerRadius As Int [write only]
      Set the corner Radius - by default is 0
    • SetImageOnFail As String [write only]
      Sets own icon on fail
    • SetImageOnLoading As String [write only]
      Sets own icon on loading
    • SetNoEffect As Boolean [write only]
      Can display bitmap with rounded corners.
      Show thumbnails with corner radius or oval. - by default is true
    • ShouldOnlyAnimateFling As Boolean
      Get or Sets should only animate fling.
    • ShouldOnlyAnimateNewItems As Boolean
      Get or Sets should only animate new item.
    • ShowMessageError As Boolean [write only]
      Set to true if you want to display an error message.
    • SimulateGridWithList As Boolean
      Get or Sets simulate grid with list.
    • SmoothScrollbarEnabled As Boolean [write only]
      When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed based on the number of visible pixels in the visible items.
    • StretchMode As StretchModeEnum
      Defines how columns should stretch to fill the available empty space, if any.
      Examples:
      GridView.StretchMode = GridView.StretchMode.STRETCH_SPACING
    • Tag As Object
      Get or Sets this view's tag.
    • TextBackGroundAlpha As Int
      Get or Sets alpha property of the view, as a value between 0 (completely transparent) and 255 (completely opaque).
      <b>by default alpha = 0</b>
    • TextBackGroundColor2 As String [write only]
      Sets the background color for this view.
      Example:
      TextBackGroundColor2("#88666666")
    • TextColor As Int
      Get or Sets Text Color - by default White
    • TextGravity As Int
      Get or Sets the horizontal alignment of the text that will be used.
    • TextLines As Int
      Get or Sets the TextView exactly this many lines tall.
    • TextPosition As TextPositionEnum
      Get or Sets the position alignment of the text that will be used.
      <b>param Text_Top_OutSide</b>
      <b>param Text_Top_Inside</b>
      <b>param Text_Center_Inside</b>
      <b>param Text_Bottom_Inside</b>
    • TextSize As Int
      Get or Sets Text Size - by default 14
    • TextStyle As Int [write only]
      Sets the style in which the text should be displayed.
    • TextTypeFace As TypefaceUtils
      Get or Sets the typeface and style in which the text should be displayed.
      Note that not all Typeface families actually have bold and italic variants,
      so you may need to use TextStyle(style) to get the appearance that you actually want.
    • TextVisible As Boolean
      Get or Sets the visibility of the text - by default is hide
    • TransitionDuration As Int
      Get or Sets transition duration.
    • TransitionEffect As TransitionEffect
      Get or Sets the desired transition effect.
    • Version As String [read only]
      Version of the library
    • VerticalSpacing As Int [write only]
      Defines the default vertical spacing between rows.
 

Attachments

  • GridView.jpg
    GridView.jpg
    92.4 KB · Views: 4,284
  • gridview.jpg
    gridview.jpg
    80.3 KB · Views: 3,847
  • B4AGridView_v3.70_Demo.zip
    337.7 KB · Views: 1,195
  • B4AGridView_v3.70_Lib.zip
    461.2 KB · Views: 781
  • B4AGridView_v3.70.pdf
    102.2 KB · Views: 895
  • B4AGridView_Lib_v3.80.zip
    408.7 KB · Views: 861
  • B4AGridView_Lib_v3.80_Fix.zip
    409.4 KB · Views: 1,250
Last edited:

Carlos marin

Active Member
Licensed User
Longtime User
hello friends, could raise some complete example to use this library. thank you very much


Hi guys, B4AGridView is updated to v3.30 whit new Image Loader engine.

The zip include:

the library.

1: GridView Demo
1: GridView with B4APhotoPager Demo
1: PDF Explanations

******************** GridView v3.50 ********************
1: Library
1: License



A big thanks goes to ( Sergey Tarasevich - author of Universal Image Loader )

A thanks is always appreciated.

B4AGridView
Author:
Giuseppe Salvi
Version: 3.2

  • Fields:
    • Center As ScaleType
      Center the image in the view, but perform no scaling.
    • Center_Crop As ScaleType
      Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
      will be equal to or larger than the corresponding dimension of the view (minus padding).
    • Center_Inside As ScaleType
      Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
      will be equal to or less than the corresponding dimension of the view (minus padding).
    • Fit_Center As ScaleType
      Scale the image using CENTER.
    • Fit_End As ScaleType
      Scale the image using END.
    • Fit_Start As ScaleType
      Scale the image using START.
    • Fit_XY As ScaleType
      Scale the image using FILL.
    • Matrix As ScaleType
      Scale using the image matrix when drawing.

  • Fields:
    • Default As Typeface
      The default NORMAL typeface object.
    • Default_Bold As Typeface
      The default BOLD typeface object.
    • Monospace As Typeface
      The NORMAL style of the default monospace typeface.
    • Sans_Serif As Typeface
      The NORMAL style of the default sans serif typeface.
    • Serif As Typeface
      The NORMAL style of the default serif typeface.
    • Style_Bold As Int
      The default BOLD style int.
    • Style_Bold_Italic As Int
      The default BOLD ITALIC style int.
    • Style_Italic As Int
      The default ITALIC style int.
    • Style_Normal As Int
      The default NORMAL style int.
    Methods:
    • TextTypeFace.LoadFontFromAssets (file As String) As Typeface
      Create a new typeface from the specified font data from assets.
    • TextTypeFace.LoadFontFromFile (file As String) As Typeface
      Create a new typeface from the specified font data from sdcard.

  • Fields:
    • Text_Bottom_Inside As GravityWrapper
      Text Bottom InSide
    • Text_Center_Inside As GravityWrapper
      Text Center InSide
    • Text_Top_Inside As GravityWrapper
      Text Top InSide
    • Text_Top_OutSide As GravityWrapper
      Text Top OutSide

  • Fields:
    • AUTO_FIT As Int
      Creates as many columns as can fit on screen.
    • NO_STRETCH As Int
      Disables stretching.
    • STRETCH_COLUMN_WIDTH As Int
      Stretches the spacing between columns.
    • STRETCH_SPACING As Int
      Stretches columns.
    • STRETCH_SPACING_UNIFORM As Int
      Stretches the spacing between columns.

  • Fields:
    • Compress_Format_JPG As CompressFormat
      Compression Format JPG
    • Compress_Format_PNG As CompressFormat
      Compression Format PNG
  • PhotoGridView
    Events:
    • ItemClick (Position As Int, Tag As Object, Value As Object)
    • ItemLongClick (Position As Int, Tag As Object, Value As Object)
    Methods:
    • AddImage (dir As String, file As String)
      Add an image from sdcard or AssetsDir at the end of the GridView
    • AddImageAt (index As Int, dir As String, file As String)
      Add an image from sdcard or AssetsDir to the desired position in the GridView
    • AddImageFromWeb (address As String)
      Add an image from web at the end of the GridView
    • AddImageFromWebAt (index As Int, address As String)
      Add an image from Web to the desired position in the GridView
    • ClearDiskCache
      Clears disk cache.
    • ClearMemoryCache
      Clears memory cache
    • DestroyEngine
      Stops ImageLoader and clears current configuration. Use this option on exit app.
    • GetArrayList As List
      Get or Sets an array.
    • GetImageListFromAssets (path As String, sort As Boolean) As List
      Get entire list of images stored in assets or sub-folder
      Examples:
      Dim lv as ListView
      Dim l as list
      l.Initialize
      lv.Initialize("lv")
      Sub Menu_Click
      Activity.AddView(lv,0,0,100%x,100%y)
      l = GridView.GetImageListFromAssets("Here the Images folder stored in Assets")
      or
      l = GridView.GetImageListFromAssets(File.DirAssets)
      or
      l = GridView.GetImageListFromAssets("")
      For n = 0 To l.Size-1
      lv.AddSingleLine(l.Get(n))
      next
      End Sub
    • GetItem (position As Int) As String
      Returns Item
      Example:
      i.Bitmap=LoadBitmap("",g.GetItem(Position))
    • Initialize (EventName As String)
      Initialize the object
    • Initialize2 (EventName As String, ownCache As String)
      Initialize the object and set own cache directory
    • Pause
      Pause ImageLoader. All new load and display tasks won't be executed until ImageLoader is resumed.
      Already running tasks are not paused.
    • ResumeEngine
      Resumes waiting load and display tasks
    • SetArrayList (array As ArrayList)
      Get or Sets an array.
    • SetText (index As Int, text As String)
      Sets the string value of the TextView.
    • ShowFromAssets (path As String, sort As Boolean)
      Populate GridView from assets or assets/sub-folder
    • ShowFromMediaStore (sort As Boolean)
      Populate GridView from media store
    • ShowFromSdCard (dir As String, path As String, sort As Boolean)
      Populate GridView from sdcard
    • ShowFromWeb (mStrings() As String, sort As Boolean)
      Populate GridView from web
    • StopEngine
      Cancels all running and scheduled display image tasks.
      NOTE: This method doesn't shutdown if you set them.
      ImageLoader still can be used after calling this method.
    • TextBackGroundColor (red As Int, green As Int, blue As Int)
      Sets the background color for this view.
      by default red = 0
      by default green = 0
      by default blue = 0
    • isPauseOnFling As Boolean
      Whether pause ImageLoader during fling
    • isPauseOnScroll As Boolean
      Whether pause ImageLoader during touch scrolling
    Permissions:
    • android.permission.INTERNET
    • android.permission.WRITE_EXTERNAL_STORAGE
    Properties:
    • CacheInMemory As Boolean [write only]
      Sets whether loaded image will be cached in memory.
    • CacheOnDisk As Boolean [write only]
      Sets whether loaded image will be cached on disk.
    • ColumnWidth As Int
      Get or Sets Specifies the fixed width for each column.
    • CompressFormat As BitmaCompressionWrapper
      Get or Sets the known formats a bitmap can be compressed into [ JPG or PNG ]
      by default PNG
    • CompressQuality As Int
      Get or Sets the quality of a bitmap, that can be compressed. [ 0 = low -> 100 = high ]
      by default 100
    • DelayBeforeLoading As Int [write only]
      Sets delay time before starting loading task. Default - no delay.
    • FadeInTime As Int [write only]
      Duration of "fade-in" animation (in milliseconds)
      Whether animation should be played if image is loaded from network
      Whether animation should be played if image is loaded from disk cache
      Whether animation should be played if image is loaded from memory cache
    • Gravity As Int [write only]
      Specifies the gravity within each cell.
    • HorizontalSpacing As Int [write only]
      Defines the default horizontal spacing between columns..
    • ItemHeight As Int
      Get or Set ItemHeight
    • ItemWidth As Int
      Get or Sets ItemWidth
    • Length As Int [read only]
      Returns length
    • LoadFontFromAssets As String [write only]
      Loads a new Typeface from the specified font data.
    • LoadFontFromFile As String [write only]
      Loads a new Typeface from the specified font data.
    • NumColumns As Int
      Get or Sets the number of columns in the grid.
    • PauseOnFling As Boolean [write only]
      Whether pause ImageLoader during fling
    • PauseOnScroll As Boolean [write only]
      Whether pause ImageLoader during touch scrolling
    • ProgressBarIndeterminate As Boolean [write only]
      Change the indeterminate mode for this progress bar.
    • ProgressBarVisible As Boolean [write only]
      Set the enabled state of this view. - by default is true
    • RemoveAt As Int [write only]
      Removes the item at the specified location from this list.
    • RoundedBitmap As Boolean [write only]
      Can display bitmap with rounded corners. - by default is false
    • ScaleType As ScaleTypeWrapper
      Controls how the image should be resized or moved to match the size of this ImageView.
      by default ScaleTypeFIT_XY
    • ScaleTypeForRounded As ScaleType [write only]
      Controls how the RoundedBitmap should be resized or moved to match the size of this ImageView.
      by default ScaleType.FIT_CENTER
    • Selection As Int
      Get or Sets the currently selected item.
    • SetBorderColor As Int [write only]
      Set the border Color - by default is transparent
    • SetBorderWidth As Int [write only]
      Set the border Width - by default is 0
    • SetCornerRadius As Int [write only]
      Set the corner Radius - by default is 0
    • SetImageOnFail As String [write only]
      Sets own icon on fail
    • SetImageOnLoading As String [write only]
      Sets own icon on loading
    • SetNoEffect As Boolean [write only]
      Show thumbnails with corner radius or oval. - by default is true
    • ShowText As Boolean
      Get or Sets the visibility of the text - by default is hide
    • StretchMode As StretchModeWrapper
      Defines how columns should stretch to fill the available empty space, if any.
      Examples:
      GridView.StretchMode = GridView.StretchMode.STRETCH_SPACING
    • Tag As Object
      Get or Sets this view's tag..
    • TextBackGroundAlpha As Int
      Get or Sets alpha property of the view, as a value between 0 (completely transparent) and 255 (completely opaque).
      by default alpha = 0
    • TextColor As Int
      Get or Sets Text Color - by default White
    • TextGravity As Int
      Get or Sets the horizontal alignment of the text that will be used.
    • TextLines As Int
      Get or Sets the TextView exactly this many lines tall.
    • TextPosition As TextPositionWrapper
      Get or Sets the position alignment of the text that will be used.
      Text_Top_OutSide
      Text_Top_Inside
      Text_Center_Inside
      Text_Bottom_Inside
    • TextSize As Int
      Get or Sets Text Size - by default 14
    • TextStyle As Int [write only]
      Sets the style in which the text should be displayed.
    • TextTypeFace As TypefaceUtils
      Get or Sets the typeface and style in which the text should be displayed.
      Note that not all Typeface families actually have bold and italic variants,
      so you may need to use TextStyle(style) to get the appearance that you actually want.
    • Version As String [read only]
      Author and Version of the library
    • VerticalSpacing As Int [write only]
      Defines the default vertical spacing between rows.
 

Dave61

Member
Licensed User
Longtime User
I was planning to use the gridview as a grid of buttons for the user to select a task. The interface looks good cosmetically and the person using it is happy with it apart from 1 problem:

The grid only takes up half the screen. When the user clicks on a button/image then some more Views appear to be filled in and finally a Send button is used to complete the task and clear the extra views until the next button/image is pressed.
I cannot find a way to 'highlight' the button/image that has been pressed in the grid. Ideally I would like either a highlight border around the selected image or all the non-selected images to be 'greyed-out'. Are either of those possible or is there another way that anyone has found to highlight the selected image?

As an alternative to that, I thought that I could have the Activity title show the name of the button pressed as a reminder. I use:
gridview1.ShowFromAssets
to load the grid from a list of files in the Files folder. However, I can't see any way to retrieve the filename (which has a good description of the task if I just trim off the '.jpg' from the end) from the selected item. All I can get is the Position which shows the number of the button being pushed. Is there any way to get the original filename without me having to include an extra list or had code a list?

Thanks,

Dave
 

Ferdari

Active Member
Licensed User
Longtime User
Thanks lonely... another tedious problem is that:

if I use the text, when i scroll down and after i return in the top of the items, the text change wrong and displays the text of other items. If I repeat the procedure (scroll down and scroll up) the text changes again with text other items yet....

Can you fix this?

THANKS!!!

i support this, @lonleystar did you have any update of why the error occurs?
 

Mashiane

Expert
Licensed User
Longtime User
Hi guys, B4AGridView is updated to v3.60 What's new:

Update the engine.

------------------------------

Fix:

GridView.CompressFormat -> PNG work well now.

------------------------------

Added Event:

ShareItemClick

------------------------------

Added:

TransitionEffect
Get or sets an effect

Example:

TransitionEffect = TransitionEffect.CARDS

STANDARD -> is flat effect

Effects:

STANDARD, GROW, CARDS, CURL
WAVE, FLIP, FLY, REVERSE_FLY
HELIX, FAN, TILT, ZIPPER
FADE, TWIRL, SLIDE_IN
REVERSE_TWIRL, PUZZLE

------------------------------
Added:

TransitionDuration
Give the duration in milliseconds to the animation

------------------------------

Added:

MaxAnimationVelocity

Give maximum speed in milliseconds for animation

------------------------------

Added:

ShouldOnlyAnimateNewItems

Animate the item only Once
value true : false

------------------------------

Added:

ShouldOnlyAnimateFling

Animate flayng
value true : false

------------------------------

Added:

SimulateGridWithList

Simulate grid with list
value true : false

------------------------------

Added:

ShowActionBarToShare -> Min sdk 11

Example:
B4X:
Sub Activity_Create(FirstTime As Boolean)


   'give exactly these names to png stored in assets as described in the array below.

   'The png size must be Min 64x64 or Max 128x128

   Dim icons() As String = Array As String("gmail.png","email.png","gmx.png","dropbox.png","facebook.png","twitter.png","telegram.png","line.png")

   GridView.ShowActionBarToShare(icons)

End Sub
------------------------------

Added:

ShareItemsTo -> [ ShareItemsTo(appName,item,"Subject Here","Message Here","Title Here") ]

Share any items to android-gmail, twitter, facebook, telegram, line, whatsapp, android-mail, dropbox, gmx-mail for Deutsch, etc,etc.

Click on any item and then choose from actionbar which one you'd like to share.

Example:
B4X:
Sub Globals

   Dim posSelected As Int

End Sub

Sub GridView_ItemClick(Position As Int, Value As Object)

   posSelected = Position

End Sub

Sub GridView_ShareItemClick(Value As Object)


   Dim share As String = GridView.GetItem(posSelected)  -> From sdcard, assets, web

   ShareItemsTo(Value,share,"Subject Here","Message Here","Title Here")

   or

   ShareItemsTo("",share,"Subject Here","Message Here","Title Here")


End Sub
------------------------------

Added:

ShareTextUrlTo

Share any text or URL

Example:
B4X:
Sub Button1_Click

   Share any URL

   GridView.ShareTextUrlTo("Subject Here","http://www.salvigiuseppe.altervista.org","Message Here","Title Here")

   GridView.ShareTextUrlTo("Subject Here","https://lh4.googleusercontent.com/-Z4zGiC5nWdc/URqvBdEwivI/AAAAAAAAAbs/ZRZR1VJ84QA/s1024/Sin%252520Lights.jpg","Message Here","Title Here")

   Share any Text

   GridView.ShareTextUrlTo("Subject Here","Any text U wish to share here","Message Here","Title Here")

End Sub
------------------------------

Added:

GoToWebsite

Opens the browser giving it an address
B4X:
Sub Button1_Click

   GridView.GoToWebsite("http://www.salvigiuseppe.altervista.org")

End Sub
------------------------------

Added:

GetIndividualCacheDir

Returns individual application cache directory (for only image caching from ImageLoader).
Cache directory will be created on SD card ("/Android/data/[app_package_name]/cache/b4AGridview-Images").

B4X:
ToastMessageShow(GridView.GetIndividualCacheDir,True)

------------------------------

Added:

GetCacheDir

Returns application cache directory.
Cache directory will be created on SD card ("/Android/data/[app_package_name]/cache").
B4X:
ToastMessageShow(GridView.GetCacheDir,True)
------------------------------

Added:

GetRealImagePath

Returns the exact path of the image.
B4X:
Sub GridView_ItemClick(Position As Int, Value As Object)
   Dim item As String = GridView.GetItem(Position)
   ToastMessageShow(GridView.GetRealImagePath(item),True)
End Sub


the library is comiled with jdk1.7.0_80 and android-22 platform

I'm sorry i forgot to upload the icons

put the icons in files folder

Hi, this is such a lovely library, you might have to consider moving this post to the first post, It's easier when updates are done there as we now have to read all the posts to get important information about updates. :)
 

cwkoomy

Member
Licensed User
Longtime User
hi big bro/sis, im still learning, have any sample for 3.6? im try 3.2 sample but cant use in 3.6 lib
 

aidymp

Well-Known Member
Licensed User
Longtime User
Just come across this today, and I cant initialise the gridview using 3.60 of the lib. as I see a few others have found. i can however use 3.50 but I was hoping to use the features of 3.6! Any information/news of why it wont even initialise?

Thanks

Aidy
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hello, nice work ...
but I'm try to runing 3.6 but always have a java.lang.StackOverflowError,
anyone have a sample working with 3.6 ???

thanks !!!
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hello again,
i'm trying the library version 3.50, and found a fail with the sort names.... i don't know why the names not sort with images...
the curiosity..is on version 3.20 work perfectly..every text on correct image...
i'm try with index and without but can't good work.... anyone have a solution ?
thanks !!!

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
End Sub

Sub Globals
    Dim GridView As PhotoGridView
    Dim fromWeb() As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.Color=Colors.white

     GridView.Initialize2("GridView","hola")
    '*************************************
    Activity.AddView(GridView,4dip,4dip,100%x-8dip,100%y)
    '*************************************
    GridView.ItemWidth= 20%x
    GridView.ItemHeight= 20%x
    GridView.HorizontalSpacing = 3dip
    GridView.VerticalSpacing = 3dip
    GridView.NumColumns = 2
    '*************************************
    GridView.ScaleType = GridView.ScaleType.Fit_XY
    '*************************************
    GridView.SetNoEffect = False
    GridView.FadeInTime = 10
    GridView.RoundedBitmap = False
    GridView.SetBorderColor = Colors.white
    GridView.SetCornerRadius = 0
    GridView.SetBorderWidth = 5dip
    '*************************************
    GridView.ProgressBarIndeterminate = False
    GridView.ProgressBarVisible = False
    '*************************************
    GridView.ShowText=True
    GridView.StretchMode=GridView.StretchMode.STRETCH_COLUMN_WIDTH 
    GridView.TextBackGroundAlpha=200
    GridView.TextBackGroundColor(255,255,255)
    GridView.TextColor=Colors.black
    GridView.TextGravity=Gravity.LEFT
    GridView.TextPosition=GridView.TextPosition.Text_Bottom_Inside
    GridView.TextSize=14
    GridView.TextLines=3
    '*************************************
    GridView.CacheInMemory=True
    GridView.CacheOnDisk=True

    fromWeb = Array As String( _
    "https://lh4.googleusercontent.com/-Z4zGiC5nWdc/URqvBdEwivI/AAAAAAAAAbs/ZRZR1VJ84QA/s1024/Sin%252520Lights.jpg", _
            "https://lh4.googleusercontent.com/-_0cYiWW8ccY/URqvBz3iM4I/AAAAAAAAAbs/9N_Wq8MhLTY/s1024/Starry%252520Lake.jpg", _
            "https://lh3.googleusercontent.com/-A9LMoRyuQUA/URqvCYx_JoI/AAAAAAAAAbs/s7sde1Bz9cI/s1024/Starry%252520Night.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg")

    GridView.SetText2(0,"  hello 0" & CRLF & "  segunda linea" )
    GridView.SetText2(1,"  hello 1" & CRLF & "  segunda linea" )
    GridView.SetText2(2,"  hello 2")
    GridView.SetText2(3,"  hello 3")
    GridView.SetText2(4,"  hello 4")
    GridView.SetText2(5,"  hello 5")
    GridView.SetText2(6,"  hello 6")
    GridView.SetText2(7,"  hello 7")
    GridView.SetText2(8,"  hello 8")
    GridView.SetText2(9,"  hello 9")
    GridView.SetText2(10,"  hello 10")
    GridView.SetText2(11,"  hello 11")
    GridView.SetText2(12,"  hello 12")
 
    GridView.ShowFromWeb(fromWeb,False)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub
 
Last edited:

aidymp

Well-Known Member
Licensed User
Longtime User
Hello again,
i'm trying the library, and found a fail with the sort names.... i don't know why the names not sort with images...
i'm try with index and without but can't good work.... anyone have a solution ?
thanks !!!

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
End Sub

Sub Globals
    Dim GridView As PhotoGridView
    Dim fromWeb() As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.Color=Colors.white

     GridView.Initialize2("GridView","hola")
    '*************************************
    Activity.AddView(GridView,4dip,4dip,100%x-8dip,100%y)
    '*************************************
    GridView.ItemWidth= 20%x
    GridView.ItemHeight= 20%x
    GridView.HorizontalSpacing = 3dip
    GridView.VerticalSpacing = 3dip
    GridView.NumColumns = 2
    '*************************************
    GridView.ScaleType = GridView.ScaleType.Fit_XY
    '*************************************
    GridView.SetNoEffect = False
    GridView.FadeInTime = 10
    GridView.RoundedBitmap = False
    GridView.SetBorderColor = Colors.white
    GridView.SetCornerRadius = 0
    GridView.SetBorderWidth = 5dip
    '*************************************
    GridView.ProgressBarIndeterminate = False
    GridView.ProgressBarVisible = False
    '*************************************
    GridView.ShowText=True
    GridView.StretchMode=GridView.StretchMode.STRETCH_COLUMN_WIDTH  
    GridView.TextBackGroundAlpha=200
    GridView.TextBackGroundColor(255,255,255)
    GridView.TextColor=Colors.black
    GridView.TextGravity=Gravity.LEFT
    GridView.TextPosition=GridView.TextPosition.Text_Bottom_Inside
    GridView.TextSize=14
    GridView.TextLines=3
    '*************************************
    GridView.CacheInMemory=True
    GridView.CacheOnDisk=True

    fromWeb = Array As String( _
    "https://lh4.googleusercontent.com/-Z4zGiC5nWdc/URqvBdEwivI/AAAAAAAAAbs/ZRZR1VJ84QA/s1024/Sin%252520Lights.jpg", _
            "https://lh4.googleusercontent.com/-_0cYiWW8ccY/URqvBz3iM4I/AAAAAAAAAbs/9N_Wq8MhLTY/s1024/Starry%252520Lake.jpg", _
            "https://lh3.googleusercontent.com/-A9LMoRyuQUA/URqvCYx_JoI/AAAAAAAAAbs/s7sde1Bz9cI/s1024/Starry%252520Night.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg")

    GridView.SetText2(0,"  hello 0" & CRLF & "  segunda linea" )
    GridView.SetText2(1,"  hello 1" & CRLF & "  segunda linea" )
    GridView.SetText2(2,"  hello 2")
    GridView.SetText2(3,"  hello 3")
    GridView.SetText2(4,"  hello 4")
    GridView.SetText2(5,"  hello 5")
    GridView.SetText2(6,"  hello 6")
    GridView.SetText2(7,"  hello 7")
    GridView.SetText2(8,"  hello 8")
    GridView.SetText2(9,"  hello 9")
    GridView.SetText2(10,"  hello 10")
    GridView.SetText2(11,"  hello 11")
    GridView.SetText2(12,"  hello 12")
  
    GridView.ShowFromWeb(fromWeb,False)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Did you get 3.60 to work? I cant even initialise it!

Thanks

Aidy
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hi, yes You ar right I'll find why It does this and something else. Thanks for reminding me.

Hello, Lonleystar... really is very good work, but are problem with a text, can you fix that??? please ....
and the library 3.60 can't start... can you put any sample?

really thanks !!!!
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hello to all
you can also use GridView to add buttons or panels? If so, how?
Thank you
 
Top