Android: Design consideration for layout - android

I have to design the following layout:, which basically resembles a planner. Here, I have to show schedule for whole week. So far, I had completed the following part .
Now, I am stuck with this part: . I am not getting idea to design this part.
The highlighted portion in the grid indicates an event at that time. My problem is how can I make grids the one illustrated.

I would use 2D graphics and draw it completely in code.
It will be really hard to use xml to achieve this design, You could give it a shot with AbsoluteLayout but it is deprecated.
As about algorithm how to do it, first define a range of hours Your timetable will have,
You don't need full 24h, if all events are in range 8am-8pm for example displaying hours from 8pm to 8am would be a waste of sapce.
Get size of screen and calculate a size of one rectangle for the smallest time-frame.
And later it is simple maths to calculate position and size of rectangle to represent event.

Related

Scrolling home screen in LibGdx

I am using LibGdx to develop a game. For Now I am not using scene2D. I am struck up in increasing the levels of the game as I do not have the scrolling screen.
I like to design a a scrolling screen as it is in many games which are level based (for ref, lets say Candy crush). Could you please point me a example on how to have such a scrolling screen to show a bigger area where I can show many levels.
Thanks is Advance !
Using the Scene2D function is not necessary for this and is more for GUI implementation and different screens. The Scroll pane really shines when creating reading content that does not fit your phone. I do advice to start learning Scene2D to create MenuScreens and UI though.
What Candy Crush "simply" does is having multiple backgrounds that are placed next to each other and tile seamlessly. They use buttons in the correct place for levels. By dragging a finger across the screen the camera will move in that direction. For the movement from one level to the next there is probably something like a spline in play.
It is important only to draw the background tiles and buttons that are actually visible on the screen if you have many. Since these have fixed positions and you know your camera area and position you can calculate what to draw and what not. Just drawing everything each frame is likely to slow down your fps.
You can do a search on:
Tilemaps, for you backgrounds but you probably want them in just one direction so a simple 1D array would suffice.
Dragging, to move your camera. Here I gave a basic explanations on how I do it.
Splines, are a bit tougher and you do not really need them. They could be used to animate or move something along a curve.
Thats all, expecting you know how to create something like a button (click a sprite).

How to dynamically add slices to a disk image?

Hi I am new to Android and I am currently experimenting with some Android features.
So I wanted to find a way to add flexibly add slices to a disk image (could be a pie chart or a roulette wheel). I have done some research on this topic, Drawable Resources | Android. If I wanted to insert a slice dynamically, I think the InsetDrawable method would best suit my situation. So that a bitmap would not be recreated every time the image changes. I have also gone over some tutorial on how to change Cartesian coordinates into Polar coordinates Android SDK: Creating a Rotating Dialer. I was hoping to combine the InsetDrawable method with the polar coordinates to achieve this function. So I was wondering if can anyone tell me whether or not my thoughts are feasible?
A sample of the image that I would like to get is shown below:
Instead of having 6 slices, the user could add more elements to populate the disk to make it 8 or 10 slices, or remove slices from the disk.
It would be great if anyone can share a link to some of the related topics or tutorials as such.
Thanks in advance :)
What is that you exactly want? If you want to dynamically add a slice every time you click a button, all you have to do is arrange the 6 slices in the form of a circle in the xml as 6 ImageViews. You will have to make these ImageViews invisible initially. And inside the onClick function of the button you make the ImageViews visible one by one.

I want to make a rectangle slowly extend across the screen taking exactly 1 second in android

Basically, I am making a rectangle that represents charge on your weapon. I want a green rectangle to advance over a red one after a certain amount of time. My issue is the timing. I have no clue how to do any timing anything in android.I'm fairly new so don't use too many things I might not understand. All of this is within a view. I researched threading and handlers, but just got confused.
Check out View Animations if you want to support pre 3.0 without using a library. OR Property Animations if targetting 3.0+ is ok.
I have more experience with the View Animations and I can tell you that the Scale animation is the one you'd be looking for. Make your X scale to 100% its size perhaps would get the job done.

Android: Speedometer Style Layout

I have been trying to make a layout for an Android app that functions like a car Speedometer.
Something like this:
I basically want there to be 5 clickable Views across the radius of the dial, and have the dial point to the currently selected item. If possible it would be good to be able to click and drag the dial. I would also want this layout to work nicely with different screen sizes and resolutions, including tablets.
How could something like this be accomplished?
I don't know exactly how much this will help, but it goes over a similar design and shows how to place things at angles around a curve.
For each selectable view, I would also advise that you keep use keep track of the coordinates of each item, so you can use trig to calculate the proper angle for the dial to display (getting the dial to display at an angle is covered in that link).
So, you can set up OnClickListeners for each of your selectable items about the gauge, and in each instance, calculate the proper angle for the dial to spin to, and position it there using the information found in that link.
I'm not sure how much this helped, if at all, but it should at least give you an idea on creating custom Views and whatnot.
Good luck!

Effcient way of programming and displaying an analog image?

I'm redesigning an analog gauge widget I made a while back, essentially wanting to give it smoother looks and touch interfaces.
Currently I have just three bitmaps, on for the frame of the gauge, on for the ticks and a base that covers 1/3 of the gauge located at the bottom. I use a canvas drawn line for the needle. This gauge works, but doesn't have many of the features that I would like.
What I would like to do is have the ticks be dynamically drawn so it is possible to simulate a pinch based zoom. As the user zooms in the ticks drift apart until there is enough space for a new subset of tick to appear nested in between the larger farther apart ticks. As the user zooms out the tick begin compressing until the smallest tick are forced out become invisible (not drawn). The gauge will also need to register a slide (across the circumference of the gauge) touch to force the gauge to rotate.
The last time I tried to draw each line on a canvas for a gauge, it was incredibly slow was not readable because it flickered so horribly.
So I am wondering if anyone has any idea's, source or tips on how to achieve this gauge. I have spent a good while googling compasses, clock and gauges that may have any or all of the features I want so I can see how others did it, but I can't find anything.
Any help will be appreciated.
~Aedon
I found a fantastic tutorial not only on the gauge, but in genreral android features. Take a look.

Categories

Resources