I want to make a button with black background but no shadow. When I click the front button, yellow button's x, y and z coordinates should move to black button's coordinates. How can I make a button like this. Thank you.
Related
I'm trying to develop a custom application that uses Camera 2 API and I would like to add the feature "tap to focus". In other words, when I tap on the screen to focus, it shows a circle of the focus area.
How can I draw the circle focus area?
I followed the Google Camera2Basic example.
Thank you.
May be enough is draw circle of tap area, not focus area? In this case You can save X and Y pos of tap and use it as center of circle. And You can use any tutorial for drawing over camera preview, like that.
I dont know how to achieve this effect on long click. Long click on image in pinterest android app. Three buttons sliding from red ring to left.
Edit: like this https://github.com/GnosisHub/GHContextMenu
Put 3 invisible ImageViews in the layout (these are the buttons). Set an onLongCLickListener on the larger ImageView. When the long click occurs, make the three buttons visible and animate them into position with ObjectAnimator or ViewPropertyAnimator. When you want to dismiss the buttons, animate them back to where they started and make them invisible again.
You will have to do some math and figure out how far to translate (move) the buttons in the X and Y directions, and it will be different for each button. I suggest placing the buttons where you want them to be when they are visible. When you want to animate them, calculate the difference between their current position and the center of the larger image (or from the touch location). Then you set translation X and translation Y to those values and animate them back to 0.
I am working on an android application.
I need to have 2 buttons but similar to the following picture.
The red triangle is a button and the yellow is another button.
How can this be achieved?
Is there a way to do it other than having it as 1 picture and then checking the touch position? because that would involve a lot of math and might not be precise. Also if I use this method I cannot have a clicked state on the each button seperatly. (like when the button grays out on touch down)
Thanks for any tips.
I have a sin function in my graph, and the user is able to select points on it. However, when the only PointStyle in the renderer is POINT, the background of the zoom color is white/transparent (not sure since my background is white). However, when I add PointStyle.CIRCLE (for when the user selects a point on the function) the background of the zoom buttons change to gray. When I remove the point, it changes back to white/transparent.
Is there a way to force the background color of the zoom buttons?
Also, is there a way to change the container shape of the zoom buttons. From round corners to sharp corners. Perhaps by override?
You cannot change the zoom buttons look and feel. However, you can create your custom zoom buttons and hide the default ones.
I am using triangle shape button (PNG image), I need to make clickable only on the image visible area. As you can see in the image of my triangle shape button below , in the image I need to make clickable only on the image visible portion ie black and red, the green area will remain transparent and non clickable. Please help me this respect I would very thankful to you. Thanks in advance.
Identifying image area clicked in Android? check this question
OR if green will be transparent,
I think the easiest way to detect whether 'visible' content of the image was clicked, is to hook up an OnTouchListener, get the touch coordinates and subsequently get the color for those coordinates using Bitmap.getPixel(int x, int y). Since this will return an ARBG color, you should have little problems with images using an alpha channel. Anything that is 'transparent' (if green will be transparent?) will be invalid, everything else will mean the actual content was tapped.
something like this as a start up:
int color = Bitmap.getPixel(x,y); // x and y are the location of the touch event in Bitmap space
int alpha = Color.getAlpha(color);
boolean isTransparent = (alpha==0);
You can refer to this link:
Image Map
Or you can also refer this similar question :
Link
But, i would not recommend doing so as you have to manually calculate the coordinates and apart from that android screen has different sizes so it may cause a problem for you.
You can set OnTouchListener to your View and check was click inside of triangle shape or not (OnTouch event sends MotionEvent object, you can get coordinates of touch event from it).
May be it will be better, if button will be clickable as rectangle? Like here, on stackoverflow, vote buttons has triangle form too, but they are clickable on rectangle shape.