how to click Background and something should happend? - android

I want to click the Background of a layout (not clicking anywhere, for example in the top right) and then reproduce a sound, can i put an empty View and put an On Click to that? I think is not possible.
If is possible, there is a better way?
I want to put some invisible "buttons" at the Background because I will put an image Background with shapes, that's why It couldn't be anywhere.
Thanks and sorry for my english.

You can put a button on the right corner and apply an empty or simply transparent image as icon button.
In this way, you can choose a different behavior for each screen position.

Related

Android ImageButton - How to hide the image while showing the background?

I've read the API and Googled but perhaps I've missed something: All the visibility options on an ImageButton seem to talk about this view as a whole. So, what should I do if I want to hide the image but keep the background(except for explicitly setting the image to something transparent that is)? I'm doing a Pairs Game and when one clicks on the element it should show the image and if the next click doesn't match the image should be hidden, but the grey background of the button should remain.
Thanks!
So, what should I do if I want to hide the image
Try setting it to #null or create transparent PNG in your drawables and set it.
in XML, remove android:src="something" and in the code remove imgbtn.setImageBitmap(null);
Instead of using ImageButton you can use ImageView with a FrameLayout on top of it. Set the background of FrameLayout as gray color and then show/hide this FrameLayout/Image as per your requirement. Take relative layout for each and make it clickable. On the click event of this layout, do the changes as required.

creating an "elevated button" effect in android

I want the button to appear as though it has space in between the bottom of it's face and the canvas. Then, when clicked, it will appear as though there is no space between the button and the canvas. I know I can style the button with xml to give it those 2 looks but I don't know how to do the elevated look.
My question is how would one go about doing this?
Easiest approach to this is creating 2 background images, each fitting the state you want, then you can either set the backgrounds according the button's state, or change the backgrounds by setting an onTouchListener to the button.

How can I tint/ dim an Activity

I have a button in my actionbar, when I click that I want to dim the current Activity. Fading the alpha wont work because the background is white and I need it to darken.
Cheers
Probably the simplest way would be to create a View scaled to cover the entire activity end set its background color to something half-transparent. You can also check how the stock Alarm app does it.
Cover the entire layout with Dim Gray transparent image (i.e.., overlay the image with the entire screen). I hope this idea will work for you

How do I make a picture seem like a radiobutton?

I am attempting to use my own buttons to make an overlay at the bottom of the screen. When a button is pressed it should light up (kind of how a radio button turns green when selected) and it should take you to a new activity while keeping the overlay intact.
There are five buttons that should be put on a black bar and when selected it should turn blue.
If someone could send me in the right direction I would be very grateful. Thank you
You need StateListDrawables for your buttons.

Arrow buttons or best recommendation on UI for traversing records like VCR buttons

I trying add arrow buttons to my app. I dont know how to show arrows on button ?
http://www.bestandroidappsreview.com/2010/09/build-vocabulary-sat-gre-buddy-android-app.html
otherwise , I want some suggestion on what would a good interface for traversing of records for next and previous ??
To show an Arrow on button, You need to have an Images for the Arrow. Usually when you use Image button, it keeps the background of the button as normal button so you can not have a look and feel like the one you have.
The Best option is use ImageView instead of Button or ImageButton and Use Arrow Images to show Arrows.

Categories

Resources