Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a density in emulator android studio

I would like to create an emulator of Samsung Galaxy XCover4S (720 x 1280 px (5.00") 294ppi 64.6% screen-to-body ratio). However I found only how to set a predefined densities (like 120,240,320) and many more densities (ppi) in .android\avd\~~\config. Is there a posibility to set it as 294?

Greetings

like image 523
CallMePedro Avatar asked Oct 15 '19 11:10

CallMePedro


People also ask

How can I get density in Android?

You can get info on the display from the DisplayMetrics struct: DisplayMetrics metrics = getResources(). getDisplayMetrics(); Though Android doesn't use a direct pixel mapping, it uses a handful of quantized Density Independent Pixel values then scales to the actual screen size.

How do I change dpi in emulator?

If you are using Eclipse go to Window - Android SDK and AVD Manager , there hit the New button, enter a name and select the SDK version, hit the Resolution option down in the Skin section and set the resolution you need.

What is density in Android?

Density refers to how many pixels have been physically squeezed into a 1 inch x 1 inch area. In digital displays / screens like monitors, phones, and tablets, density measurement unit is PPI (pixels-per-inch).


Video Answer


1 Answers

No. It is not possible to set the density to 294.

You can only choose between the following DPIs:
120, 160, 213, 240, 280, 320, 360, 400, 420, 480, 560, 640


To set the density, do the following:
After creating the emulator, open ~/.android/avd/my_avd/config.ini and append:
hw.lcd.density=560

like image 142
npkllr Avatar answered Oct 26 '22 12:10

npkllr