bsky
bsky

Reputation: 20222

How to set width and height of an Android Emulator

I would like to specify the width and the height on an Android emulator in order for it to emulate a real device that I have that has width 1440 height 1920(not sure in what units of measurement, the values for width and height are printed with the following React Native code).

var {height, width} = Dimensions.get('window');
console.log("Width is: " + width);
console.log("Height is: " + height);

I have set the resolution to be 1440*1920 hoping that its width and height should be 1440 and 1920 respectively.

However, I get this:

Width is: 411.42857142857144
Height is: 683.4285714285714

So, how can I make an emulator have a specific width and height? What do I need to change in its configuration?

Upvotes: 0

Views: 1427

Answers (2)

Pavel Biryukov
Pavel Biryukov

Reputation: 1145

One more link on that - the size is not not in pixels but "represent density-independent pixels" - so the emulator is configured ok. https://facebook.github.io/react-native/docs/height-and-width.html

Upvotes: 0

krmzv
krmzv

Reputation: 387

The actual problem is that different dimension units are used on web and mobile, there's no px units on mobile. Check this -> what dimension units are used in React Native?

Upvotes: 1

Related Questions