5
votes

I am trying to emulate a Huawei Y530. According to this site, it has the following specifications:

Screen: 480 x 854 pixels, 4.5 inches (~218 ppi pixel density)

This is what my WEB APP looks like on the actual device:

enter image description here

And this is what it looks like on a emulator, with the following specification:

Target: Android 4.3 - API Level 18
Device: 4" WVGA (Nexus S) (480x800 hdpi)

enter image description here

I know there is a difference in the height of the two devices, but still I believe that the emulator should show something similar to what the actual device is showing.

I tried to find the innerWidth and innerHeight of the real device with the following code:

var viewportwidth;
var viewportheight;

 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
alert (viewportwidth);
alert(viewportheight);

The result is width: 320px and height: 544px

The innerWidth on the emualtor is: 480px and the innerHeight: 756px

Since the real device had a width of 320px, i tried using an emulator with the following specs:

Screen: 3.2" QVGA (ADP2) (320 x 480 mdpi)

With the following result:

enter image description here

2
I found something similar in this post: stackoverflow.com/questions/9749212/… But there is no "Resolution" optionKenci

2 Answers

0
votes

You can always create a new emulator if the app will be developed only for this particular phone. The image attached emulates the exact properties of the Huawei Ascend Y530 phone.

New Emulator Screen

Alternatively, if the app is being developed for different phone having different screen sizes, I would take a look at the xml file for the layout. Take note of the following attributes, like placing form widgets in relation to other widgets. For example: android:layout_toRightOf="@+id/ukFlag" for the Danish flag. There are actually several layout parameters you can paly around with until you get the right layout:

  • Layout_toLeftOf
  • Layout_toRightOf
  • Layout_above
  • Layout_below

You can also setup the positioning of the widget, to be either left_based, right_based or centred.

Hope this would help you better: Android Layouts

-2
votes

Without knowing too much in how you have done your application, it seems you are using fixed units like pixels to specify size. As this project is a web app, maybe you should consider to use what is called a Responsive Design approach. In that way your content can adjust to whatever size the screen is.

I'll let you a couple of useful articles to learn more about this: