# Android Pixel size - dpi - scalefactor

**URL:** <https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016>\
**Category:** Android\
**Created:** [June 14, 2015, 6:17pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016 "2015-06-14T18:17:07Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolaiaudios](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@nikolaiaudios](https://forum.juce.com/u/nikolaiaudios)\
**Post date:** [June 14, 2015, 6:17pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/1 "2015-06-14T18:17:07Z")

</div>

I´m trying to create an app on both ios and android.

ios seems to work ok, but on my android device (HTC One M8) the UI and text is super-small.

The app fills the entire screen but everything is very small.

fo laying out my buttons / text I use relative values (for example a button that covers 50% of the height)

But something is cleary wrong since text is very small etc.

What is the thing to do here?

I tried to mess with Desktop::setGlobalScaleFactor() but that &nbsp;does not seem to work.

I though I could figure something out based on the dpi values.

Anyone has any ideas about this?

---

<div class="post-metadata">

**Author:** ![nikolaiaudios](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@nikolaiaudios](https://forum.juce.com/u/nikolaiaudios)\
**Post date:** [June 15, 2015, 6:05am UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/2 "2015-06-15T06:05:06Z")

</div>

After looking at it a bit more, I´m not even sure what I´m asking for&nbsp; ![blush](http://www.juce.com/sites/all/libraries/ckeditor/plugins/smiley/images/embarrassed_smile.gif "blush")

I guess i'm looking for a "best-practise" tip for makeing the ui look about the same on each platform,. First priority is to make the fonts bigger, and consistent.

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [June 15, 2015, 3:53pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/3 "2015-06-15T15:53:47Z")

</div>

We have a fix for this problem and we will push it to master once Jules has got a chance to review the code.

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [June 15, 2015, 5:09pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/4 "2015-06-15T17:09:05Z")

</div>

This is now fixed on the latest tip.

---

<div class="post-metadata">

**Author:** ![nikolaiaudios](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@nikolaiaudios](https://forum.juce.com/u/nikolaiaudios)\
**Post date:** [June 16, 2015, 7:30pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/5 "2015-06-16T19:30:09Z")

</div>

Thank you for the fast update. Tested and it works GREAT!

thank you

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [June 17, 2015, 8:28am UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/6 "2015-06-17T08:28:43Z")

</div>

Great news thanks Fabian and co&nbsp;

---

<div class="post-metadata">

**Author:** ![audiooffler](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiooffler/32/693_2.png) [@audiooffler](https://forum.juce.com/u/audiooffler)\
**Post date:** [June 18, 2015, 8:16am UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/7 "2015-06-18T08:16:00Z")

</div>

Tank you. But it seems not to work right with OpenGL.

I try to use an OpenGLContext for the top level component. So in the constructor of the main window i call:

```
Desktop::getInstance().setGlobalScaleFactor(1.5);                
openGLContext->attachTo(*getTopLevelComponent());
```

- The display renders wrong scaled, while mouse handling uses the scale factor.
- The problem occured&nbsp;on both of my target platforms, Windows and Andoid.

See the following screenshots (left with opengl, right how it looks without openGL).

(Also notice&nbsp;where the mouse cursor is positioned to highlight the upper right menu button.)

| Wrong, with OpenGL context: | Right, without OpenGL (how it should be): |
| ![wrong rendering, using OpenGL](http://wwwpub.zih.tu-dresden.de/~spindler/forumImages/globalScaleOpenGLwrong.png) | ![right without opengl](http://wwwpub.zih.tu-dresden.de/~spindler/forumImages/globalScaleRight.png) |

Is it possible to fix this?

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [June 23, 2015, 11:17pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/8 "2015-06-23T23:17:05Z")

</div>

I can confirm this is working for me. Now it looks much closer to what I see on my Mac and Introjucer, i.e. not so small.&nbsp;

---

<div class="post-metadata">

**Author:** ![audiooffler](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiooffler/32/693_2.png) [@audiooffler](https://forum.juce.com/u/audiooffler)\
**Post date:** [December 1, 2015, 2:10pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/9 "2015-12-01T14:10:00Z")

</div>

also see following thread:&nbsp;see http://www.juce.com/forum/topic/setglobalscalingfactor-and-opengl

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [December 16, 2015, 3:00pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/10 "2015-12-16T15:00:53Z")

</div>

I've just hit the same problem as mentioned above. I'm using JUCE 4.02 and Android 5.1.1. Calling Desktop::getInstance().setGlobalScaleFactor() with anything but a 1 moves and reszies my OpenGL window to the top right hand corner of my handset. It works fine with the software renderer, so I'm sure my scaling factors are correct. Any ideas?

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [December 29, 2015, 1:02pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/11 "2015-12-29T13:02:14Z")

</div>

This sounds like a JUCE bug.&nbsp;I'll have a look at it. It only seems to occur if you change the defaultScale factor manually via `setGlobalScaleFactor`.

&nbsp;

In the mean time you can set the default scaling factor by changing the calculation on line&nbsp;[juce\_gui\_basics/native/juce\_android\_Windowing.cpp:744](https://github.com/julianstorer/JUCE/blob/master/modules/juce_gui_basics/native/juce_android_Windowing.cpp#L744). This seems to work for me.

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [December 29, 2015, 4:29pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/12 "2015-12-29T16:29:57Z")

</div>

I'm glad you think it may be bug. I was beginning to doubt myself! For now I'm dynamically resizing all components which works, but is not ideal. Please let us know when you find a fix. Thank you.

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [January 13, 2016, 4:18pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/13 "2016-01-13T16:18:07Z")

</div>

Any movement on this? Can you at least confirm there is something afoot here? Thanks.&nbsp;

---

<div class="post-metadata">

**Author:** ![Alan](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Alan](https://forum.juce.com/u/Alan)\
**Post date:** [February 27, 2016, 5:42pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/14 "2016-02-27T17:42:40Z")

</div>

Yeah as Fabian says you can workaround this by forcing&nbsp;the d.scale value in the findDisplays method (the line # that Fabian gave is not good anymore).

It would be great that this be fixed, however, as it is an important feature to develop cross-platform...

&nbsp;

---

<div class="post-metadata">

**Author:** ![Alan](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Alan](https://forum.juce.com/u/Alan)\
**Post date:** [February 28, 2016, 11:03am UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/15 "2016-02-28T11:03:00Z")

</div>

Any short-term plan to fix this ?

Thanks

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [February 16, 2024, 2:38pm UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/16 "2024-02-16T14:38:06Z")

</div>

I’m seeing the same issues in the latest release of JUCE ☹

---

<div class="post-metadata">

**Author:** ![peteatjuce](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peteatjuce/32/2347_2.png) [@peteatjuce](https://forum.juce.com/u/peteatjuce)\
**Post date:** [April 29, 2025, 10:07am UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/17 "2025-04-29T10:07:18Z")

</div>

I’m also still seeing this!

---

<div class="post-metadata">

**Author:** ![peteatjuce](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peteatjuce/32/2347_2.png) [@peteatjuce](https://forum.juce.com/u/peteatjuce)\
**Post date:** [June 21, 2025, 9:39am UTC](https://forum.juce.com/t/android-pixel-size-dpi-scalefactor/15016/18 "2025-06-21T09:39:50Z")

</div>

FWIW, I’ve created a detailed bug report here, which I hope is sufficient to assist in fixing the problem!

> [@Android - UI Scaling Factor Bug](https://forum.juce.com/t/android-ui-scaling-factor-bug/66427):
>
> I’ve been investigating Android use of UI Scale Factor, which doesn’t work properly for me. General symptoms: the UI scales as expected, but the app window doesn’t fill the screen and can be offset [expected behaviour: fill the screen as on iOS] touch events are scaled correctly (but can be offset), but only work in an increasingly small area of window (the bottom and right areas become unresponsive as the scaling factor increases!) [expected behaviour: respond accurately in the full app dis…

Edit: the linked post includes two patches I’ve created, which fix the use of Scaling Factor on Android. I hope this helps!

Best wishes, pete
