Android varied image position alignment in single layout - android

I am creating a game with circular buttons. I am thinking about a strategy that allows me to display variety of buttons in variety of positions in the same screen in an efficient way.
Like,
Sample images:
Image 1: 1 button
Image 4: 4 Buttons
The game works on seconds and I want the images to be changing so smoothly and should not take much time for transition. My ideas to implement this are below. Please advise me the best way to achieve this.
Use Grid view and populate items as required.
Use Open GL to display buttons.
Use a fragment and assign layouts as required.
Any other perfect way you suggest.
Note: I don't use strips to animate. All I want to do is just to do some calculation according to which button the player picks to click. And my concerns are,
1. Quick and smooth transition of layouts.
please guide me to pick the right path.
Thanks,
Karthick.

Related

How to do a grid (10000 x 10000) clickable and zoomable in xamarin forms

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).

auto layout in android

Good day, i am developing an android app which generates comic like albums, i need to fit this comic to any screen width but i have trouble doing it coz of the layouts, its very odd and doesn't seem to be aligned with one another, here :
those boxe are composed of FrameLayouts which contains and ImageView (back), the frame which is a PNG (middle) and a TextView on top of the frame image. So basically the design is very complex and odd, I've heard that there is a way to make this fit automatically on every screen on IOS, they called it auto layout i guess. Is there a counter part of this on android? Thank you.
Try using a GridLayout. You should be able to achieve what you're trying to do. There's a good blog post here.

How to create round shape image using android?

I am having four piece of image.
Here I attached one sample image.
How can I create the round shaped image using these type of images?
Which layout is best for creating the UI for android?
Thanks in advance.
are you talking about something like this..
http://www.baijs.nl/tinycircleslider/
And for designing the UI for Android is depends on our requirement.it means whether you want to design something looks like rows and columns then GridLayout and tableLayout will be better,depends on requirement and look the layout will changes once try it your self and choose the best suited for your applicaiton.All the best Mate
inside relative layout add four imageview with attrs ParentTop, ParentRight, ParentBottom and ParentLeft. every image is rectangular with transparent extra area.
i can understand it is little hard to visualize on first attempt.
now come to click area. so a runtime decision about ignore transparent area click will be right thing.
more tricky way will be manage flags for all listeners and if two listener get calls its transparent area .

How did they make such layout - which elements they used?

At the moment, I am using Euro 2012 app and it has some interesting layout parts. If you go to matches->knockout screen, you'll see 3 screens like this.
If you slide left or right, you move between them not like between one activity to another, but just like all these elements are laid on one big canvas and you slide each screen into focus. Even thou, if you slide left/right, the screen cannot be stopped in the way that half of each image is visible, so I guess it's not a big canvas. Somehow you can slide screen like one big image, and yet it always lock perfectly as if they used 3 activities for this.
How did the do this?
It's a ViewPager, available in Android support package and described in their blog.
The designing is not so much difficult, As i think to draw that boxes showing quarterfinals, semifinals.
They having layout( we can do by placing image in background also).
The major role played by FrameLayout which shows you that effect(emphasis), the flages are fetch from url as matches are decided(not essentially images only names are sufficient as flags came inside app and gets applied as updated).
After your click i think the start image gets change it's just replacing that image with new one.
As you said they are not on single canvas (but if they did customization of heir Viewpager that it's not stopping in between activities), but i think it's on single canvas.
If your taking about quickness of loading and all it's up to you as much code and processing you optimized it gives you smooth feel and fast processing.
We can appreciate the work but we can not say it's too much difficult as i think it's quit easy...
Hope this explanation helps you to understand ....

How would I go about this?(Android Whack-A-Mole Project)

I'm making a simple whack-a-mole game as my first mini-project for android. I'm not sure how to go about this. I know the basics of setting everything up and such but I'm not sure how to animate the moles and make it so that when the mole is in the up position it can be tapped and a point will be counted. I know I can do an image button and have a counter go up(counter++) but I need to be able to switch frames from the mole in the hole to the mole in the up position. Anyone have an idea as to how to do this? Thanks!
Android allows you to animate objects in a variety of ways. If you only need 2 images to switch, like a button with 'pushed' / 'not pushed' states, you can use a special type of Drawable called a selector (which allows you to specify different drawables for the various states of the target).
If you need more than two images, you may want to use the simple View animation that Android allows you to create using xml. For instance, you can create an xml animation that specifies an image to move/rotate/scale from one initial position to another, creating the in-between frames for you.
Android also has a newer, more complex and full-featured form of animation (which you probably don't need to go into).
Both of these animation systems are detailed at :
http://developer.android.com/guide/topics/graphics/animation.html
Otherwise you will need to create a series of images that you iterate through at a steady pace (which is the fundamental idea behind animation).
I've already made this before, I'll give you an overview, just check my post here: Simple Whack a Mole overview

Categories

Resources