[Q] Flexible layout for multiple screen sizes/densities - Android Software Development

I am working on creating a card game for android. I am trying to come up with a layout that will allow the game to be played on all screen sizes and densities.
I have read: developer.android.com/guide/practices/screens_support.html (I can't post links yet).
However, I am still confused on the best way to do this.
For this game, I need the cards laid out in landscape mode, in 5 columns. There are places above the 5 columns for additional cards. It is very similar to solitaire in this respect...but I only have need for 5 columns instead of 7.
What size card images should be in ldpi, mdpi, and hdpi?
What type of layout should I use (Table, Linear, Relative)?
Should I create different layouts for the different screen sizes (small, normal, large)?
Any examples you can point me to?

Related

Control sizes

Hi,
I'm working on an application where the UI is created dynamically,
and the different Layouts must be populated during runtime.
For some reason, when I add a new control such as an EditText, of a small height - for instance 20, the control is not displayed correctly - that is instead of the entire control being resized, it is being partly cropped.
What could be the reason for such a behavior?
Many Thanks!
Vitaliy

Android Expert Required

I want to develop an app that puts a white line grid on a black background.
The grid has 3 columns and 3 rows
There is a 10% border around the grid.
The first column takes up 50% width
The second column takes up 20% width
And the third column takes 10%width
None of the columns expand or contract, they always stay the same size.
Each row is the same height.
If you click any cell, a keyboard appears on the screen allowing you to input data into the cell.
Is it possible to do this white line grid in Android?
If yes, how does one do it?
Best regards
RedTopBox.com
anyone know
Hi All
i have not received any replies.
Can anyone help please
I think it is possible. Do you have a fixed number of rows? is it small? if yes, you could directly use LinearLayout with orientation set to horizontal for each row. There you have android:layout_weight which you can use to play with the different widths you have. For the table borders, just add a View, with a background color of your preference, again use layout_weight if necessary.
If you have too many rows, or you would prefer another approach, you could use TableLayout, and for each row a TableRow, and in the same way use layout_weight for the width. For drawing the borders you could do it in this way: http://www.droidnova.com/display-borders-in-tablelayout,112.html
TableLayout has different parameters like shrinkColumns, or stretchColumns, which you will probably would need, but I am no expert on this, so you would need to play with them.
For displaying a keyboard when the user press on each element of the table, you could have a editText on each, so this would be automatically.
BTW I recommend you asking this type of questions in stackoverflow.com, and tag it with android, there should be more capable people than me to help you with this particular case.

Desktop Visualizer help

I'm using this app which rocks!!! I want to start customizing it even more but run into two issues:
1 - anyone know what the default icon size is? 12x12? 24x24? Etc?
2 - how do you get around the widget gap? I have two icons side by side and they are not flush.
Thanks!!!
Sent from my A500 using Tapatalk
1. Don't know the size for icons, but the area is 126x97, with 1 pixels between boxes.
2. Can't get around the space lengthways because it's designed for square icons.
Use one of the launcher programs that allows you to change # of rows/columns to make them square.
Look in the home screen posting thread, someone made all different sized icons for DV that have no spacing. They are all different sizes, 2x1, 2x2, and 3x3

How to Optimize Your Flash SWF Files

Flash files are used widely, but when people use it, they always need new demand. People always chase perfect. SWF files optimization is one of the chasing things. Here is the tip for how to optimaiz flash swf files.
General optimization
Please use symbols, animated or otherwise, for every element that appears more than once. You need to use tweened animations when you are creating animation sequences, because these animations occupy less file space than keyframs. Use movie clips instead of graphic symbols for animations sequences. You need to reduce the area of change in each keyframe as possible as you can to make the action happen in as small area as possible. Try your best to avoid animating bitmap elements and use bitmap images as background or static elements.
Colors
You can use Color menu in the Symbol Property inspector to create many instances of a single symbol in different colors. Then you need to use Color Mixer to match the color palette of the document to a browser-specific palette. Use gradients sparingly. You need about 50 bytes for filling an area with gradient color. You can use alpha transparency sparingly because it can slow playback.
Texts and fonts
You need limit the number of fonts and font style. Please use embedded fonts sparingly because they can increase file size. Select only the needed characters instead of including the entire font for Embed Fonts options.
Lines and elements
Do your best to group elements. You can separate elements that minimize the number of separate lines that are used to describe shapes by using layers. Reduce the number of special line types as possible as you can, such as dashed, dotted, ragged. Solid lines require less memory and lines that are created with the Pencil tool need less memory than brush strokes.
With these tips, you need not to spend extra money to buy some software or tool. What’s more, these tips are easy to understand, you are not required much flash knowledge.

Ball game - chaning ball position

I am making simple ball game and l have problem.I can't change position of Ball. I tried:
1. SetX() and setY() but lower APIs aren't supported.
2. Params and margins but when I move it left or right, the whole activity content is moving with it. Up and down moving is working fine. (Activity will have 10 ImageViews)
3. Android animations - Problem is that I can't get coorinates (getLeft(), getTop()) during the animation.
4. Canvas and draw elements - I change position of image with onDraw() and invalidate() functions but when I but backgorund and all other images (as bitmaps) it is very slow.
Can you give to me any ideas or suggestions? Thanks in advance.
Can you post the code? What do you exactly want to be done, there can be many different "ball games". You want to change the position of a bitmap or circle on the screen create x and y variables, draw bitmap or circle using them and if they change, the object will be drawn elsewhere

Categories

Resources