Custom Rating Bar with various screen sizes - android

This is very frustating.I have made a custom rating bar with the help of this link: http://kozyr.zydako.net/2010/05/23/pretty-ratingbar/
And now when I look with various screen sizes to check the rating bar..It shows me very strange view.I have to use this rating bar in various hence I can not make layouts for all screen sizes...I have to work with one layout for various screen.

give values in dp instead of dpi. see the docs. I also suggest you to use different images for different devices like hdpi,mdpi,xhdpi.

Related

application not fit to the android virtual device

In my android application, I have a problem that when I run my application, its not fit to the emulator and some part cut on it like below:
And also you can see below I have a button also on it like below image:
But its not show me the full image, means a button is missing on the emulator.
How can I resolve it. kindly suggest me, waiting for reply.
Thanks
Basically, your designer and emulator are using different screen dimensions.
You can change the designer to use the same screen dimensions. Currently, from your screen shot you're using the Nexus One layout. From what I can tell the emulator doesn't look like the Nexus One screen dimensions.
With Android it isn't as simple as 1 layout for all dimensions, screen sizes and devices. You have to implement multi-screen support to address this. You can usually do this by having a variance on dimensions, styles and layouts. A lot of the time one layout will work universally, but dimensions often need tweaking.
See http://developer.android.com/guide/practices/screens_support.html for more on Supporting Multiple Screens.
It is a problem that can occur in real devices (remember, we have loads and loads of different screen sizes for android) so you definitely need to fix it.
The best way to avoid this is to wrap the entire layout inside a ScrollView, so the user can scroll to see all the content of your layout.
If you are trying to fit all the elements on the screen then you need to account for different screen sizes and densities. In your particular case you are building the screen on a different sized screen than the emulator.
Assuming you do not want the screen to scroll (which is solved using a ScrollView), then to fix this, you can do the following:
Build different XML layouts for different screen sizes
Use dimen files to specify different sizes for some or all elements on the screen so that they re-size depending on the screen size.
Use weighted LinearLayout so that Android re-sizes the elements according to the screen they are placed on.
Each of these is pretty easy to search and find various ways of doing.

Layout of a android application

I'm working on the layout of an android application. But I have a question about the layout. Once i have created a layout and then go to another screen (for instance 4 inches to 5 inches) all my buttons and text boxes are messed up..
Is there a method to make everything static, so that my layout works on every mobile phone..
What kind of layout are you using, could it be RelativeLayout? that might be your problem in this particular instance.
Anyway, in android there are many screen sizes, each of them you should handle with different layouts depending on orientation, size and density. There is no magic formula as far as I know, but 9-patch images can help a lot. Another thing you should do is make sure that you understand how match_parent and wrap_content values work for height and width.
Check this out: Suppoting different screens
You have to create folders for different types of screens take a look at android developers training
This document contains everything you need.
Instead of having everything fixed, it shows how to design a layer that adapts to the various screens you may encounter.

Android Graphic designing

I'm developing a simple app with a customized background and a button in the middle.
I've got the whole different resolutions for different screens down, but do all the versions of the background need to be 9patches? How do I take into consideration the always there android top navigation bar and the possible use of advertisements at the bottom? Do they just cover the design or do they change the resolution?
I've got the whole different resolutions for different screens down
that's not how it works on android. see this:
http://developer.android.com/guide/practices/screens_support.html
do all the versions of the background need to be 9patches?
no . you decide . normally, buttons and views use the 9 patch images, but it can be useful for many other things. more info:
http://android10.org/index.php/articlesother/279-draw-9-patch-tutorial
http://radleymarx.com/blog/simple-guide-to-9-patch/
How do I take into consideration the always there android top
navigation bar and the possible use of advertisements at the bottom?
you can put a linear layout which has the ad on the bottom , and once it will be shown , the upper view will shrink its size.
about the action bar on the top, it doesn't matter , since the layout is below it anyway.
if you wish, you can also hide the top bar. however , if you have the bottom navigation bar (as on honeycomb and some ice-cream sandwich devices ) , you can't just hide it , since the end user must be able to press the back and home buttons .
Do they just cover the design or do they change the resolution?
you (and also those components) can't change resolution just like on a PC . everything takes space depending on your code and layout.
it seems that you need some guidelines of how to design for android. may i suggest checking out those links:
http://developer.android.com/design/index.html
http://www.google.com/events/io/2011/sessions/designing-and-implementing-android-uis-for-phones-and-tablets.html
http://www.google.com/events/io/2011/sessions/honeycomb-highlights.html

android multiple layouts for different screen sizes

I have a screen that I need to remove some items on smaller screens because they will not fit.
I search for items in the layout to populate with live data in code, such as populating names etc. There are 5 items that need to be populated in my large layout but only 2 in my small layout as three I removed because they won't fit. How in my Activity can I tell that I am in "Small mode" and not search the layout for the three id's that I want to skip and not populate?
Do I need to just search for them and catch the errors and ignore or is there a better way?
Thanks
It looks like in this circumstance the widgets will return null when I attempt to find them if the layout chosen doesn't support that widget. So I can just detect if its null and if so skip populating the widget.
You will want to utilize a combo of the resource directories (high, medium, low) and follow the guidelines on how to support multiple screen sizes from the android documentation. Also you can get the screen dimensions if you need to anything specific in the code. See these links.
Get screen dimensions in pixels
http://developer.android.com/guide/practices/screens_support.html

Creating photos to use as ImageButtons in my app - regarding size

When creating images to place as ImageButtons in my app, what is the staple rule to go by in terms of width? I know each phone will resize accordingly with a wrap_content parameter, but what is the universal width I should be using? These are basic titles for each layout I am using, as reference.
Thanks!
Depends on what kind of icon you are creating (menu, app launcher, etc..). Icon sizes also depend on screen density.
Check out Icon Design Guidelines.

Categories

Resources