Set font scale in Android emulator using adb - android

I'm trying to change the font size in Android emulator (Pixel) programatically with adb. The commands are executed successfully but I see no difference in the font size. What is missing?
Already tried with other numbers (2.0, 0.5 etc) as well.
$ANDROID_HOME/platform-tools/adb shell settings put global font_scale 1.5
$ANDROID_HOME/platform-tools/adb reboot

Related

Android Emulator Screen Resolution looks higher than set

Trying to match a specific device screen in an emulated device though it seems/looks like it higher than desired.
Looking at screenshot the first is a physical device, specifically the Nabi Big Tab, a 20inch screen with a resolution of 1600 x 900
and comparing that to the emulated device it seems like the emulator is a higher resolution...
Tried
hw.lcd.density
other questions found are for pre Android Studio 3
Start the emulator and connect the physical device to input adb commands
then execute the following using -d to send the command to the device:
adb shell wm density
it should return something like with the Nabi Tab Physical density: 213
then using -e to send command to the emulator:
adb shell wm density 213
The problem with that is the screen changes and puts the navigation bar on the right side instead of the bottom of screen...
So I found the navigation bar moves when density > 200 so using 200 is as close as I have been able to figure...not to mention it is an invalid value and does cause issue...
What can I do to make the screenshots match sizes more closely/ accurately?
Start the emulator and connect the physical device to input adb commands
then execute the following using -d to send the command to the device:
adb shell wm density
it should return something like with the Nabi Tab Physical density: 213
then using -e to send command to the emulator:
adb shell wm density 213
also check that you match the device hardware buttons or lack there of
You can save the value for use at start see -> https://stackoverflow.com/a/43860845/1815624
Still not 100% a better answer is desired
From reading the following article 213 is for TVs... this may play a part...
https://www.captechconsulting.com/blogs/understanding-density-independence-in-android
Andriod Studio Ver 3: (this is for RESOLUTION adjustment):
in Studio, go to Tools -> AVD Manager -> Edit this AVD ( click the pencil icon on the right side)
then
change the device Device (right udner AVD name input box), to what ever your want. it Nexus 6P for higher resolution.
To change scale/size of AVD, just use Ctrl + up_arrow/down_arrow.

ADB set display-size is incorrectly displaying portrait using landscape

I am using the adb feature to set the screensize to see how the app looks on smaller screens.
using the command :
adb shell am display-size 1200x720
in 4.3 the command is
adb shell wm size 1200x720
But it is seems to be behaving stupidly as it displays portrait view of the app in landscape view of the device.
Leaving so much screen not used and result is a smaller looking device than need be. The device is the Nexus 7
Just swap the order of the dimensions. So instead of 1200x720, use 720x1200. That should do it for you.

how to resize physical android screen from terminal/shell

A while ago, I was able to resize the screens on Android. For example, I had a Xoom, and was able to run a command from ADB which shrunk it down to a 7" screen (leaving a black border around it). Granted, it was a little buggy because the home/back/app-switch buttons disappeared, but I know it's possible. It's a 1 line command where I input the new screen resolution in X and Y pixels for the Xoom.
I was wondering if anyone was familiar with this, and knows how to do it.
(and if anyone says it's not possible, I can assure you it is)
(and I want to do this so I can test apps in various screen sizes on my Nexus 10, and I'd prefer not using an emulator)
An update to this answer for Jelly Bean 4.3 from Android dev Adam Powell on Google+ (link found via this SO answer):
In Android 4.3 these options moved from the "am" command (ActivityManager) to the "wm" command (WindowManager). Type "adb shell wm" for details.
So you can now run on 4.3 devices:
adb shell wm size 1280x800 or whatever size or reset
and
adb shell wm density 480 or whatever density or reset
Just make sure the screen is not currently displaying at the moment you run the command.
I believe it is:
adb shell am display-size
but i am away from a computer to try it. An example use would be:
adb shell am display-size 640x480
you can also change the resolution via android terminal, just type "wm size 720x1280" for example.

Changing screen resolution on android devices without re booting

I tried changing the screen resolution in build.prop file in system, but it requires re booting.
I need a solution for changing screen resolution on android devices without re booting.
Thanks,
Krishna
Unfortunately that is not possible. Everytime when Android boots, it will read the build.prop file and set parameters pointed by it accordingly. After it has booted, it will not access that file dynamically to change parameters. So for any change to take effect, a reboot is compulsary, you cannot escape it.
Set resolution (e.g. 1024x768):
$ am display-size 1024x768
Reset:
$ am display-size reset
Doesn't require a reboot. This works with Android 4.2. Solution for 4.3 is mentioned by LiTTle
There is also an App for that called NOMone Resolution Changer.
Android can change the screen resolution.
I think that you need Android 4.0 and above version.
Only things you need is terminal emulator and root access.
Reproduce the following steps:
1. Open the terminal emulator app.
2. Type su.
3. Type wm.
Read the help message appeared and you will understand...
In case you want an App take a look at this on Play Store or the source from Github.

How to resize the AVD emulator (in Eclipse)?

I'm writing my first Android app for a small business that has some Droid phones. I set up an AVD for the phone with the right resolution: 854 pixels high.
I'm working on a MacBook Pro with a max screen resolution 900 pixels high, so when the emulator starts up, the bottom is cut off.
Is there a way to scale the emulator display down to 75% or something so that it fits on my screen? Any other solution (other than running everything on the phone itself)?
This is actually possible from your project as well, no need to start the emulator through the AVD manager:
Go to Run > Run Configurations... > (Select your application on the left hand side) > (Click the "Target" tab on the right hand side).
At the bottom there, you'll see Emulator launch parameters. In the additional emulator command line options, add '-scale 0.75' (to make the screen 75% of full size)
Next time you start the emulator it will have scaled properly.
From within Eclipse:
Go to Window > Android SDK and AVD Manager > Virtual Devices
Select the AVD you want to launch and click Start
Check the Scale display to real size button
Enter how big you want it to appear in inches and press Launch. For this to work, you'll have to also enter a reasonable approximation of your mac's screen resolution. I'm using 7 inches and 113 dpi for my 13" Macbook Pro, but you may be able to get away with 8 or 9 inches.
There is also a way to re size the emulator through a windows command prompt.
From command prompt run: telnet localhost 5554
window scale 0.75
quit
Assuming there is one emulator running with on port 5554.
The telnet answer above is great for Android Studio developers. I just wanted to add that the window scale command will take either a scale factor OR the dpi which may be easier for many people (measure once and it should work for you ADV which are 1dp:1 pixel)
telnet localhost PortNumOfAVD
window scale 96dpi
quit
Note telnet is not installed on windows by default anymore.
For Changing the window size of the Android Emulator
Append the parameter -scale ­­<scale factor> to the Emulator launch parameters. In eclipse, put it in the field "Additional Emulator Command Line Options" within the Run Configuration.
Allowed scale factors are those between 0.1 and 3, although the most common will probably be -scale 0.5 .
If you are working with Eclipse, than here's is what you can do if the size of the emulator is too big for you screen:
Run > Run Configurations
Pick the "Target" tab
Scroll down to "Additional Emulator Command Line Options" and put in: "-scale 0.7" or another number
This will keep the AVD scaled even if it is started automatically by Eclipse.
Enjoy
If you launch your emulator outside of Eclipse, using the android command, you will be able to scale the screen as part of the launch process. Not sure how to do that in Eclipse, though.
I definitely recommend running the emulator through terminal or command line because it allows you for much better control.
For example, if you want to run emulator in different size, you just need to run it like this.
~/Android/Sdk/tools/emulator -scale 0.35 -avd Nexus_5_API_23
Nexus_5_API_23 corresponds to existing AVD on my host computer. When you create different Android Virtual Devices, you can just replace it with name of your device and it works.
So basically you just run emulator from Android SDK's tools directly. You can also add other parameters like netdelay, netspeed etc.
The command to open in Command Prompt is given below
emulator -avd [- []] ... [-]. for details see http://developer.android.com/tools/help/emulator.html
To open a desired size emulator window follow the below command
emulator -avd "AVD_Name "-scale "Scale_Value"-dpi-device "dpi"
Example:
emulator -avd "AVD_Name "-scale auto -dpi-device 160/200.
So just change the dpi-value according to your need. Hope u enjoy.
Another option would be to use the GenyMotion emulator, where you can actually resize the emulator window in real time. It is also much faster than the stock emulator.
You can permanently change window size of emulator by changing in config.ini file of avd
For that you need to follow this path
First go to your android #home directory
Then go to .android folder
Then avd folder and go to your avd named folder
you will see config.ini file
In config.ini file change the value of skin.name and skin.path to your conveniency. I have set it to 480x600 .

Categories

Resources