Greetings,
Using SetBitmap changes one of my ImageView bitmap image from a circle shape to a square shape. That caught me by surprise. Please check my usage of SetBitmap and please let me know how I messed up the displaying of my image.
This is what the play-circle icon looked like before and after using SetBitmap:
Using SetBitmap changes one of my ImageView bitmap image from a circle shape to a square shape. That caught me by surprise. Please check my usage of SetBitmap and please let me know how I messed up the displaying of my image.
This is what the play-circle icon looked like before and after using SetBitmap:
B4X:
Sub ImageViewPlayPauseSong_Click
' The xCLV has a button on each item row. "Sender" will know which of those
' buttons raised this click event.
'-------------------------------------------------------------------------------
Dim ViewThisImageView As ImageView = Sender
Dim intindex As Int = clvSongList.GetItemFromView(Sender)
CSelections.ItemClicked(intindex) ' Show the CLV item as selected or unselected.
kvs.Put("CurrentSongSelected", intindex +1) ' This is the song number to play.
Log( "intIndex: " & intindex)
Log( "intLastClickedIndex: " & intLastClickedIndex)
If intindex <> intLastClickedIndex Then
' From the xCLV line item at the index from the view that was last clicked.
'--------------------------------------------------------------------------
Dim pnl As B4XView = clvSongList.GetPanel(intLastClickedIndex)
' Change the icon of the last clicked image view and make it a play icon because
' we clicked on another item line of the xCLV.
' This play/pause image view is from the panel and child panel.
'--------------------------------------------------------------------------------
pnl.GetView(0).GetView(6).SetBitmap(LoadBitmap(File.DirAssets, "play-circle.png"))
' For this current clicked ImageView we make it a pause icon.
'------------------------------------------------------------
ViewThisImageView.Bitmap = LoadBitmap(File.DirAssets, "pause-circle.png")
intLastClickedIndex = intindex
If blnAsongIsPlaying = False Then
ImageViewPlayCurrentSong_Click
End If
Else
If blnAsongIsPlaying Then
ViewThisImageView.Bitmap = LoadBitmap(File.DirAssets, "play-circle.png")
Else
ViewThisImageView.Bitmap = LoadBitmap(File.DirAssets, "pause-circle.png")
End If
ImageViewPlayCurrentSong_Click
End If
End Sub
Last edited: