highlight an imagebutton without another image - android

I was just wondering if there is a way to highlight an imagebutton when pressed without using another image as the highlighted one. thnx in advance

Try changing the selected background. Set the backgorund of the view to #selected_background

Related

Add Description or Hint to Button in android

How do add description or hint. When i touch a Button / ImageButton, I need description or hint.
Thanks in advance.
I am not sure this approach is a good idea since when you touch a Button in Android, it get's in pressed state, and when you release it will trigger the button's action. I suggest you use a different approach such as a properly formated TextView under the Button or ImageButton.

Show selected button

I have a group of buttons which enable user to select certain views on the touch screen.
I want to have the user know which view is active by showing a halo (or any other style) around the button. I mean when the button is clicked it's normal state is changed to different style but it is still normal.
I googled and checked in stackoverflow, that it is not possible to change the style at runtime.
How can I achieve the desired effect?
I have some silly ideas which I won't implement unless as last resort, like making two buttons at same positions and changing their visibility.
Or I can put each button in it's own linear layout and then set the background color of each of them, if it is possible.
Or some ImageButton manipulation maybe.
I have already overridden the default style for button for normal pressed states.
And setting focus(when in focusInTouchMode) causes problem, so that's a NO (already tried that).
Even if style can't be changed, please advise some tip to achieve the effect, it's not necessary to do it the style way. I just want o let the user know which view is selected through buttons.
use state list and set its focussed state drawable as the button with a ring around it and then at runtime say button.requestFocus(). see here for more on state list...
Go for selector xml background for each button. Best Resort
Check this link
How to set image button backgroundimage for different state?
Hpoe this helps
or you can use like ::
Button button;
public void onClick(View v)
{
button.button.setBackgroundColor(**color**);
button.setBackgroundResource(**res**)
}

How to make the button which has a kinda image( I need a detail )

I would like to know how to make the button which contains a kinda icon.
I made up a LinearLayout first and the button belongs in it.
I tried the the icon to be in the Button by using 'android:drawableLeft="#drawable/*"
The icon was placed to too Left for me.
The button is a little bit long and text and icon are small so there are some space empty.
I mean, I want the icon to be more closer to the text than it was.
Now, icon is placed to the left and text is in center.
I want them to be together with a little padding.
I tried to use 'android:drawablePadding=7dip' but it didnt work.
I so want somebody to let me know how to do it.
Have a good day.
Thank you
You can use Custom Buttons are resizes button stretch image size and below link for custom Button Tutorial link
http://www.thesecretpie.com/2010/07/creating-custom-fancy-buttons-in.html
Thanks..!
There are two techniques. I suggest you look into:
Image Buttons
Image Views
With Image view you can create a button by using an onclick listener which can be created from within your activity or from your xml layout file.

How to set selected effect when click on any image button same as iphone?

I have one screen with some image buttons and image view. when user click on these buttons or image view i need to show selected effect not replace any image instead of these. only selected dark shade effect on button or imageview same as iphone. How it's possible ?
i have not any selected image source , i checked these code ...
http://developer.android.com/reference/android/widget/ImageButton.html
But here we set another image on pressed event.
Anyone know any property of android to directly set select dark shadow
effect without image ?
Please anyone suggest how its possible ?
Thanks
you can use setAlpha method of imageView class to do this.
imgView.setAlpha(90);
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
Thats the link for adding images to show different state of buttons. You create a xml file for this and set this file as the background for the button.

How to create clickable imageButton?

I am creating a custom button to use in imageButton. I want to know will the button have a click effect when it is clicked by a user? If not what do i need to do to make it this way?
i think you want the click effect on the imagebutton... if so try this link and use selector for your purpose...

Categories

Resources