I want to create a circle layout. All of my views should be in the circle. Which layout do I have to prefer and how? The focus of the layout should be a clockwise circle.
Edit:
I can do this view and it is an update of my question, prompted by the comments to this question. Is there any example for doing that?
The screenshot is attached below.
image http://www.freeimagehosting.net/uploads/e11f35e522.png
For people who is coming to this question now I recently had to implement this circle layout and after a lot of searching I decide that a relative layout that draws a petal shaped buttons will not give me the effect I needed so I followed those steps
you can see if you tested the nbc app on iphone they are placing invisible buttons on the words and the circle is just an image with the button overlaid but I didn't like this solution .
So here's how I implemented it
1- asked for the flower with the words on it from the UI guy and told him that the colors must be solid no gradient what so ever and then asked him to send me the hexadecimal values of each color.
2- then I implemented a motion listener that checks the color of the pixel the user clicked on ACTION_UP event and launch the event corresponding with the category of that color .
3-I check the color by getting x & y from the listener and then get the color from the image bitmap
I'll post snippets of the code If anyone needs it but I don't have it on me now.
Related
I've been looking for a solution to my problem for weeks, and can't find out anything close to what I want. I need a big grid something at least 10000x10000 and even more if I can. The objective is to change the color of the cell that have been clicked. To do so users should be able to zoom in and click in one cell to modify it color. Then obviously zoom out.
I first thought to pick an image and make it clickable but to change the color of only 1 cell it would be impossible in an image.
Then I tried to do a grid with buttons inside and change their color on click, but way to long to create those inside the content page, same for labels.
Any suggestion ?
Thanks for reading
I don't believe you can do this with existing UI & Layout controls.
It will be extremely slow and hard to do.
You should use a graphic library such SkiaSharp. Here is a good tutorial to do it.
You might use pan & pinch gesture for zooming as well(howto).
Is there any solutions for this problem :
I want these two shapes with blue and pink colors to be separate buttons so whenever the pink space is clicked something happened and the same for the blue space.
PS: i can slice the two portions and create an ImageButton for each but the problem is the button doesn't take the same shape of a portion it is always rectangular so i can't place the other button next to it
I'd suppose to recommend you to write a custom View, that draw this picture itself, depending on some kind of formulae.
Or use an old method of game development when you define color of pixel that was touched or focused.
Define color of pixel touched
PS: i can slice the two portions and create an ImageButton for each but the problem is they don't fit good on the activity
Try to use 9 patch resources or svg drawables instead.
If they are defined well it should work.
Then you will have to write you're own custom button the uses them.
You can read more about it here:
http://www.vogella.com/tutorials/AndroidDrawables/article.html#9-patch-drawables
http://www.vogella.com/tutorials/AndroidDrawables/article.html#vector-drawables
I am completely new here and to developing apps. I following a basic tutorial:
http://code.tutsplus.com/tutorials/android-sdk-create-a-drawing-app-interface-creation--mobile-19021
It has three parts to the tutorial. But eventually you have an app that can draw with multiple colors, can erase, save, change the brush size and start with a new canvas.
My aim is to add an option for the user to choose a background for the canvas. I have already set a drawable to be the background for the canvas currently used. So that the kids can "color in". I now want to add a button which lets that change the background of the canvas. I would like to let them choose between 9 different "templates"
As the app has many different pieces of code, and i dont know exactly which one to paste here, please go to the tutorial page to see all the code that was used. OR just ask me which part to paste in here.
Sorry if I am being unclear or vague, but im really an early beginner.
Thanks so much.
Try overriding the onDraw method of your custom view for coloring in so that, before it draws the background drawable you have assigned, it fills itself with the color the child has selected and then change your drawable so that it is transparent apart from a hollow sketch of the object they are coloring in.
You can also work in layers by separating the background color, the drawable and the childs scribbles in three views on top of each other and combine them only when you come to save the finished work.
I'll need to implement a UI that reflects the layout of a real object. Below is the layout that the client wants. Each black block is a button, so it need a custom drawable, listeners, states, etc.
I'd like to use a custom implementation of the Button widget, but as far as I know they only accept rectangular touch targets and laying them out could be tricky.
What would you use to achieve this layout?
Please note: the 2 central button should be a semicircle cutted in half (with some padding between the 2), not this strange shieldy shape, I'm just not that good with Photoshop.
EDIT: As suggested in this question I could use a TouchListener on the layout and fake a click on the right button. The main problem with this solution is that I'll need to know the bounds of the drawable, not the rectangular ones of the button's bounding box (that is always rectangular). How could I do that?
Im working with android about image and onclick listener. The purpose of my app is to monitor the area that user clicks on the screen. For example, I have a picture containing a rectangular and a circle. Assume that the color of the whole picture is brown(wood). So when I click on the rectangular, the color of rectangle will change to yellow. When I click on the one part of the picture, the color of that part will change its color, but other parts do not change. So, Im thinking about the solution for this app. Do I have to cut this picture separately and put them into the screen by using relative review? Or is there any other way to do this(Set up a coordination system)?
Yes you have to cut this picture separately and put them into the screen by using relative review. For example two ImageView with your backgound.
You can slse the image as recommeded by the other post, or overlay the image with a RelitiveLayout with specific sized buttons (background = #android/color/transparent)