I'm using Android Studio to make an app where you can create your own animal, and I want to know how I can layer pictures on clicking a button, if it can be done.
For example, suppose I want to create a teddy bear- I will first click a button to display the bear's plain body, then clicking another button should layer a transparent image of the eyes over the same body (and so on for the nose, mouth, clothes, etc.) I have attached two images as examples of which pictures should appear one over the other when their respective buttons are clicked.
IMAGE 1: This is the body of the bear that will appear when I click the button that says "body"
IMAGE 2: A transparent image of the eyes, dimensions same as the previous image. On clicking the button "eyes" this image should be overlayed onto the previous one
There are many ways of doing it, but I assume you know about OpenGL. That is the standard graphics renderer. With it you can layer as many images as you want.
For instance, you can load the images into the sampler and click-by-click you render the collection of images (given the positioning is taken care of).
Related
Good day guys.I want to make the bottom part of my own image an curved line.Not to talk back and forth here is an image which i want to get into the application.
Important to notice that i have reached 10th result of the google and everything i came up was only some curved image not in my desired way,the whole image was curved and the lines of 4 parts were connected to single one.
So basically i want the image to be as rectangle as it comes from server and only curve the bottom part of a bitmap.Is that even possible?
Noticae the bottom line is curved,that what i want to achieve,and rest parts are rectangle.Thank you for your time.
If you are trying to change the image itself, photoshop or any editing tool is the right way to do it. besides if you are getting the image from a server somewhere then getting the image adjusted from the server, instead of modifying it on the client side(o your app) has lot of benefits.
But, if want to change the look not the image itself, then that could be achieved by creating a custom image view like answered here.
You can also use a card view hold your image view to achieve some curves, although i don't think that would be efficient or satisfactory for your case.
Sometimes, editing the image in Photoshop is the right way. This can save your android app CPU time.
photo: https://imageshack.com/i/f0LwsdJPj
http://imagizer.imageshack.us/v2/xq90/540/LwsdJP.jpg
There is my draft, it is supposed to be like a "card library". My idea was to copy this "draf" and to have 1 pic.png for every card on the library, then when user drags the screen to one side, or touches the arrows it changes picture.
I have some questions. Is there any other way more efficient to do this? like having the same background for all them then changing only text inside them?
I'm doing it with canvas, i do: bitmapFactory.decode image ... then draw bitmap somewhere on the screen. Then, it's not an imageview so I don't know how to change text depending on device language.
Other solution could be something like canvas.WriteText somewhere but it doesn't exist, does it?
Last but not least, I have another problem with this "card" library. The "stars" drawn next to the numbers, should be shining or not depending on the user has the star or not. Do I have to copy an image with every combination? or is there any way to change only 1 part of the picture without building it with photoshop?
I'm trying to crate custom map in my application, the needed map is not Google map, its consists of image and small pins images, in other word its image view,,, i need to set buttons on this image in specific locations, and wen these buttons clicked , i need to perform some action, the problem is i didn't found a way makes me able to set buttons on this image at run time, the image and the buttons locations will be received from the server side, so i need to create this custom map at run time. maybe i need to set the buttons on specific pixels, but i don't know how i can reach specific pixels in the image, i appreciate any help in this. thank you all.
User can select some images to the screen, and be able to select/drag/move/zoom/rotate each image. When an image is selected, it will have a blue border. And user can also bring an image to the front or background.
Here is sample picture in the following: there are two images(girls) on a star-background. The top one has been selected(it has a blue border).
I don't know have to implement it. For several days of learning, I can now drag/move/zoom/rotate a single image(inside an imageview, and scaled by matrix). But I don't know how to handle multi-images.
I want to know:
Is it still a good idea to use ImageView(for each image), or what classes should I use?
How to implement the orders? (so I can bring them to front or background)
How to determine which image has been selected
How to find and draw the border of selected image?
For now, I just know how to use ImageView, but I'm not sure if I can use it to implement this task. Please give me some advices, thanks !
Drawing everything directly onto a Canvas is one way of doing it. There is an article that covers the basics of using a Canvas. You can read it HERE
There is one major downside in doing this - you have to handle all the input events by yourself. The API won't tell you which image has been clicked, or dragged. You'll have to implement that by yourself.
I've got an array of images, which I want to display in a gallery.
I want each image to have a small icon overlayed inside it, on the bottom right hand corner (e.g. a light bulb).
When the user clicks on the image or the icon, the icon will change from the 'lighbulb_off' image to the 'lightbulb_on' image, and the index of the clicked image will be added to a Vector of 'clicked images'.
Is there a way to have a custom layout for each item in a gallery? If so, each gallery item could be the original image, with the icon positioned within it using a RelativeLayout.
Is there a way to have a custom layout for each item in a Gallery?
Yes. You need to extend ArrayAdapter and override getView() to do what you want. Here is a free excerpt from one of my books that discusses the concept -- while it uses ListView as the example, the same technique should apply for Gallery.
Note that this excerpt should be updated in the next ~12 hours to be much improved, so, um, don't rush to download it right away. :-)