# How to set sketch size as a ratio of displayWidth

**URL:** <https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160>\
**Category:** Processing for Android\
**Created:** [November 3, 2019, 12:46am UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160 "2019-11-03T00:46:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![blosh](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@blosh](https://discourse.processing.org/u/blosh)\
**Post date:** [November 3, 2019, 12:46am UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160/1 "2019-11-03T00:46:24Z")

</div>

I want to set my sketch in a 9:16 ratio. Processing doesn’t allow the use of variables for size() and using displayWidth and displayHeight causes it to crash. surface.setSize doesn’t work in Android Mode. What options are there?

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 3, 2019, 1:13am UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160/2 "2019-11-03T01:13:50Z")

</div>

Could you Post your Code (relevant parts)?

You might want to try using displayWidth in settings() and not Setup() (or vice-versa).

On the other Hand, if you really just want a 9:16 Ration, just do size(900,1600), or use fullscreen() if the target Display already has a 9:16 Ratio.

---

<div class="post-metadata">

**Author:** ![blosh](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@blosh](https://discourse.processing.org/u/blosh)\
**Post date:** [November 3, 2019, 2:16am UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160/3 "2019-11-03T02:16:53Z")

</div>

Ahhh settings() does work, I didn’t realise it couldn’t have orientation() in it. Thank you. Now my next question is how do I change the colour of the area outside the sketch.

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 3, 2019, 12:21pm UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160/4 "2019-11-03T12:21:49Z")

</div>

I don‘t know what you mean by that… or actually, i don‘t think you can do that. That probably doesn‘t have to do with the Sketch anymore, so changing the Color shouldn‘t be possible… at least i never have Heard/seen that

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [November 3, 2019, 1:10pm UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160/5 "2019-11-03T13:10:24Z")

</div>

Please read following topic.

> [@Change the PRESENT mode background color in android](https://discourse.processing.org/t/change-the-present-mode-background-color-in-android/14006):
>
> In normal java mode we can change the frame bacground color with f.i.: void setup(){ size(200,200); frame.setBackground(new java.awt.Color( 255 , 0 , 0 )); } But android does not work with the awt lib, but seemingly the android.graphics lib instead How can we change the layout color in android mode.

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [November 3, 2019, 2:11pm UTC](https://discourse.processing.org/t/how-to-set-sketch-size-as-a-ratio-of-displaywidth/15160/6 "2019-11-03T14:11:20Z")

</div>

You cant in void setup, but you can in void settings.
