glow effect

anuj0sharma

Member
Licensed User
Longtime User
i want to have a glow effect for an image view on its touch event..
is it possible to have it without changing the image itself?
i mean i do not want to change the bitmap or background of the image view, just want to show a selection type..something like selecting an icon on the desktop.

thanks
 

anuj0sharma

Member
Licensed User
Longtime User
There is no automatic way to do it.
You can play with the animation library and change the image size or transparency.

thanks for the reply Erel !
does imageView.background, imageView.bitmap and imgaeView.setBackgroundImge are doing the same thing.
I mean is there something background and foreground for an image view.
e.g. making some parts of foreground image transparent, or by using transparent image will show background color or background image in transparent areas.
i hope I am able to explain my requirements. :)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
i want to have a glow effect for an image view on its touch event..
ImageView doesn't have a Touch event, but Panels do. For graphics you can work on panels like on imageViews.

e.g. making some parts of foreground image transparent, or by using transparent image will show background color or background image in transparent areas.
You can superpose onto the ImageView (or Panel) a second panel.
The first one has the background image and the second one acts like a foralayer.

Attached a small program showing tranparency effcets with panels.

Best regards.
 

Attachments

  • TransparentPanels.zip
    175.9 KB · Views: 463
Upvote 0

anuj0sharma

Member
Licensed User
Longtime User
ImageView doesn't have a Touch event, but Panels do. For graphics you can work on panels like on imageViews.

yes..i mean touch event = click event on touch screen [but touch is different in B4A..sorry for that]

You can superpose onto the ImageView (or Panel) a second panel.
The first one has the background image and the second one acts like a foralayer.

Thanks for the suggestion..i afraid this will not make the loading of the activity very slow...

Klaus, the problem for me is the no of views.. my screen size is 800x480 and there are about 30 icons of 48x48 pox on the activity for which i want to have a glow effect on click and it should be permanent untill the next click...
so only i was looking for a best approach via discussions..coz, having more and more superimposed views may increase the loading time for the activity and change of screen/activity as well.

i am trying to do this by loading already glowing images no click image now..this way i have to have two images per icon.

any suggestions are welcome..i m just learning and you are an expert.

Regards,
 
Upvote 0

anuj0sharma

Member
Licensed User
Longtime User
ImageView.SetBackgroundImage is the same as setting the Bitmap property.
The Background property allows you to set a Drawable of any kind.

There is no foreground layer to an ImageView.

Thanx for the clarification, Sir. got the difference very well.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Is there a reason to use ImageViews and not Buttons ?
In your case you could use ToggleButtons and define a different image for each state, an example is here. The advantage is that you set the two images for the button once, the image change depending on the button state is done by the OS.
Exept working with two images, I don't know of any other graphic effect that could do what you want to do.

Best regards.
 
Upvote 0

anuj0sharma

Member
Licensed User
Longtime User
Is there a reason to use ImageViews and not Buttons ?
In your case you could use ToggleButtons and define a different image for each state, an example is here. The advantage is that you set the two images for the button once, the image change depending on the button state is done by the OS.
Exept working with two images, I don't know of any other graphic effect that could do what you want to do.

Best regards.

no..i m not bound to use imageView only..will surely try the toggleButtons and will let you know the experience with it. well.. i need three images per view..
on state, off state and just selected state...i guess its possible with toggleButton as well...timebeing you can say that i've created my own toggleButton using imageview by changin images.
but if os can do it for me then nothing better than that.

thanks again for very gud suggestion, Klaus.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
ToggleButtons have only 2 states ON or OFF (state.checked or state.inchecked)
I don't know of any button having 3 states.
I'm afraid that you need to play with different images in the click events.
Buttons or ImageViews.

Best regards.
 
Upvote 0
Top