T Tom2525 Member Licensed User Longtime User Dec 23, 2015 #1 I would like to change imageview or button images during runtime. Is there a way to do that?
JonPM Well-Known Member Licensed User Longtime User Dec 23, 2015 #2 For imageview you just assign new bitmap to ImageView.Bitmap. For button: Code: Copy 'state: 0 - normal, 1 - highlighted, 2 - disabled Sub SetBackgroundImage(b As Button, bmp As Bitmap, state As Int) Dim no As NativeObject = b no.RunMethod("setBackgroundImage:forState:", Array(bmp, state)) End Sub Upvote 0
For imageview you just assign new bitmap to ImageView.Bitmap. For button: Code: Copy 'state: 0 - normal, 1 - highlighted, 2 - disabled Sub SetBackgroundImage(b As Button, bmp As Bitmap, state As Int) Dim no As NativeObject = b no.RunMethod("setBackgroundImage:forState:", Array(bmp, state)) End Sub
T Tom2525 Member Licensed User Longtime User Dec 23, 2015 #3 Never used this before as I'm new to B4A/i, but can you verify the state values? When I'm using it, the numbers seem to correspond to: IF BUTTON DISABLED: state: 0 - disabled, 1 - normal, 2 - highlighted IF BUTTON ENABLED: state: 0 - normal, 1 - disabled, 2 - disabled Last edited: Dec 23, 2015 Upvote 0
Never used this before as I'm new to B4A/i, but can you verify the state values? When I'm using it, the numbers seem to correspond to: IF BUTTON DISABLED: state: 0 - disabled, 1 - normal, 2 - highlighted IF BUTTON ENABLED: state: 0 - normal, 1 - disabled, 2 - disabled
Erel B4X founder Staff member Licensed User Longtime User Dec 24, 2015 #4 The numbers JonPM wrote are correct. Upvote 0