I have two folder res/layout and res/layout-sw600dp. When I try to run my app in Tablet Emulator 7 inch (1024x600) I see on screen layout from res/layout. How to see another layout for tablet from layout-sw600dp in Emulator?
Double click the layout you want to open or choose a different setting from the drop down menus and the relevant layout will be loaded. e.g Nexus One, Nexus S etc
Add a custom layout in this menu if the defaults do not suit your devices.
To see these layouts at runtime you need to run your app on a device\emulator that matches the layout settings.
To be able to see both layouts, you will need to use different Android Virtual Devices (AVD's), or in other words, a different Emulator. The android documentation has a page dedicated to managing AVD's.
The android development team has provided a tool that you use to create AVD's called AVD Manager. I believe that you have used it, because to be on an emulator means that you have already created one!
You can find it in Eclipse in the following location:
Window -> AVD Manager
To actually see the different layouts between the different emulators, you will need to configure them differently, to accurately represent the device you want to target. You should be able to tweak the Hardware options to make your emulators behave differently. You can find a list of hardware options here.
Related
I want to design an android layout for nexus 5 mobile and need to give a fixed width/height. After searching with many websites I have used the layout folder named as "layout-normal-xxhdi". It works perfectly for nexus 5 but unfortunately it will affect other mobiles. Ex) I tried with moto e it also takes the layout file from "res/layout-normal-xxhdpi.xml" folder. Please someone give the exact layout folder name for nexus5.
My layout folders,
res/layout.xml
res/layout-normal-xxhdpi.xml
Note:
For other mobiles it will need to take the layout file from "res/layout.xml"
You cannot do this with folder name. But you could try to recognize the device model (here Nexus 5) in your Java code and use the appropriate layout. To do that, you could use Build.MODEL.
Testing in AS v1.5 using the default Nexus 5 emulator (selected replicate device during creation), you can almost specifically target Nexus 5's specs using the "sw384dp-xxhdpi" folder name.
I'm nearly flipping out. I'm trying to develop an app for several devices. The app should nearly look the same on all devices. I tried to create the layout like this:
first i created the layout in the standard layout folder for an Samsung Galaxy S Plus device
as that's the only hardware device I have
the layout looks nice on the device
after that I took one layout file and switched through the available virtual devices such as 2.7in QVGA...5.4in FWVGA...7in WSVGA...
everytime when a switched the virtual device and the layout doesn´t look good I set the lock on qualifiers Smallest screen width and Screen size
I make the changes so that the layout looks good for that specific virtual device and saved it.
Xamarin creates an new folder like layout-sw480dp-large. In that folder I can see the recently changed file
I have done this for all layout files in the standard layout folder and for all virtual devices.
back in the standard layout folder I check all layout files with all devices. everything looks great.
I have tested the app on a Samsung Galaxy S3 and the layout looks awful, textviews are not in the right place, image views are not in the right place etc.
so back in Xamarin studio I checked all layout folders and each file. For example, in the folder layout-sw480dp-xlarge the layoutfile doesn't look good.
I changed that file but then something weird happened: all files with the same name lying in a layout folder containing the qualifier xlarge are changed too (see the screenshot).
I thought that changes in a layout folder don't cause changes in other folders. Is this a bug of Xamarin?
So I have 3 questions:
Is this weird behavoir of changing layoutfiles a bug of xamarin?
what is the best way to create layouts for different devices (please practical advises, i know the site of supporting multiple screens)
how can i create layout for Samsung S3 with Xamarin, how can i create a virtual device in xamarin which emulates the Samsung S3
Thank you very much.
i have informed xamarin about this issue. [link] (https://bugzilla.xamarin.com/show_bug.cgi?id=13705).
The way i create layouts for several devices:
Create the layouts for in standard layout folder (i take a normal mdpi device)
when all layouts were created i copy them to another folder outside xamarin and rename .axml to .xml
i use eclipse to create alternative layouts in their specific folders
rename all files inside alternative layout folder from .xml to .axml
in xamarin studio create alternative layout folders and import specific files
run and test them on real hardware devices
this works for me.
If you open axml file in Xamarin Studio, you'll find two options graphical representation/ scrip. You can switch between layouts by changing alternate layouts, switching available near top left corner of axml file.
For custom virtual device creation set same configuration as device which you want and create AVD
I updated my ADT to 21 last night, but then I found that in the ADT XML Overlay tool, I can't define a custom screen(1024*768, mdpi). Could you help me?
After Update your ADT to version 21.
In Older Version each time you have to set Add Custom Screen if you want custom Device Configurations.
In ADT21 Oversion you can get this thing done by
open AVD Manager, u can define your custom screen in "Device Definition"
Alternative (Much Easier approach)
in Newest Version you Don't Need to Set Custom Device
Configurations from the above Suggestion as much easier way is available for it. you >Just Have to Make Emulator With your Device
Configurations and after you will see those Configurations with
Emulator Name Inside Graphical Layout of XML
like after Created my Emulator of Nexus7 Emulator with Android 4.2 with Name as "Nexus7_Android_4.2" i will get this Device Configuration in Graphical Layout of xml automatically.
Below is the Screen Shot of it.
Hope it will Help you.
Is it possible to create an AVD to emulate the Nexus 4?
I am using Eclipse and I'm pretty sure I have updated all of the SDK tools etc, along with the 4.2 SDK/system Image etc.
However, when I open the AVD manager to add a new AVD, there no longer seems to be the ability to enter a custom resolution/density etc. There is a droplist containing several devices, but no Nexus 4, and no generic version with a resolution of 768x1200.
Am I just missing something obvious?
Thanks in advance for any help!
After Update your ADT to version 21.
In Older Version each time you have to set Add Custom Screen if you want custom Device Configurations as (if you want Nexus 4).
In ADT21 version you can get this thing done by
open AVD Manager, u can define your custom screen in "Device Definition"
Alternative (Much Easier approach)
in Newest Version you Don't Need to Set Custom Device
Configurations from the above Suggestion as much easier way is available for it. you >Just Have to Make Emulator With your Device
Configurations and after you will see those Configurations with
Emulator Name Inside Graphical Layout of XML
like after Created my Emulator of Nexus7 Emulator with Android 4.2 with Name as "Nexus7_Android_4.2" i will get this Device Configuration in Graphical Layout of xml automatically.
Below is the Screen Shot of it.
Hope it will Help you.
I need to make a screencast of an app to present to a client, but need it to look better than the ugly red phone or the various other incarnations of the emulator. Is there a way to swap out that image?
Also would be great to get rid of the keyboard that displays next to it and make the window borders go way (since I have to capture it full screen on a mac, unfortunately, I can't crop it tight).
When you create an AVD, you can specify a different skin to use. Besides the ones available by default, there are also a bunch on the web for various devices. You can search for "[phone name] emulator skin" to find a variety, but here are a couple of examples:
Nexus One
Nexus S
The Motorola MOTODEV site (http://developer.motorola.com/docstools/tools/) has addons for nearly every one of our released phones. Registration is required. Most of the addons are full system images, which should work or you could extract out the skin for your own uses. There is a "skin only" addon for the upcoming XOOM tablet that uses Gingerbread for the runtime.
Good luck