Eclipse doesn't show custom device in graphical layout view - android

I've created a custom device with AVD manager and it runs fine on the emulator.
However, when I open a XML layout file and switch to graphical view, in the top of the view I want to select my custom device to view how the layout fits on it.
But my device doesn't appear in the list! And there's no way to select it. All I see is the standard devices: Nexus One, Nexus 7, Galaxy Nexus etc.
Am I missing something?

In the tab where You can choose devices, there must be a category "user". If You have created the device, close eclipse and open it again and it should appear in this category

Related

How can I set the design preview in Android Studio to show a tablet layout instead of a phone layout?

I'm at the moment developing an app for tablets and the app isn't supposed to be available for phones.
When I edit an XML in Android Studio, there's the design preview that shows roughly how the XML will be rendered on the device. By default it's set to show it in a phone device. How do I set this to be a tablet view?
By default, it should have a nexus 5 and an icon at the top. Click on that icon ans a list of devices will appear.In the third listView you will find Nexus 7 where it is a tablet. CHoose one from that listView.
Go to XML EDITOR
Click on Device Editor
Now you will see different type of Device with there Name ,resolution and size
Bottom of the device list you will see Generic Phones and Tablets
In Android Studio, go to Preview - Top Toolbar:
The pixel phone name will let you choose the screen to show in the
Android Studio Preview so, this can be helpful to design the layout
for Tablets.
The second icon, has two options called Landscape and portrait which the first one Landscape will help to design the layout for the purpose.
The second option & important is, Create Tablet Variation which creates few directories for designing the Tablet layout.
There is also an option in the phone icon called Generic phones and Tablets which you might consider using.

Change my device minimum width from Android Studio

I have an Android 7.1 device, and I need something to change my "minimum width". I change that through "Developer mode" options, there I can change that.
The point is that I want to create an app that does that without going every time to options menu, and I just press on a widget and it changed. I want to know if there is any API or function to access and change that option directly from Android Studio....
Thanks for helping!
I dont think that Android Studio is able to interact with device developer options.
But if you need is to test screen layouts with different device screen widths, Android Studio let you visualize screen layout rendering preview ("design" bottom tab of layout editor) and choose different device configurations (device combobox in top of editor) with different min-widths configuration. You can also create your custom configuration.

How to avoid Eclipse open other layout when change the device?

I have an Android app and it has a layout that is duplicated in res->layout folder and in res->layout-xxhdpi. When the device is xxhdpi it uses the second layout and when its other resolution it uses default layout. It works good on real devices.
The problem is when I'm working in Eclipse and I want to change something on default layout. If I change the emulator device (on eclipse ide) to see the render it always open xxhdpi\layout. Is there anyway I could avoid eclipse to open the other layout and render the default layout with the screen I selected. I know if I select a xxhdpi device it must open the second layout but if I select a mpi device I would like to stay on default layout and render it. It is how it works on a real device.
Thanks in advance.

"Hardware Section" is missing under Android Virtual Device Manager

I was trying to fix my problem "hardware buttons not enabled in AVD" after an hour research
all I found was people who lead people to go to "hardware section and fix blabla"
but interestingly my AVD doesn't have this section.I actually found some of options under Device Definitions but still couldnt fix my problem nor found this menu.All screenshots I saw had Hardware section...
My specs are; MacOS , Android 4.2.2 (Api17) , Eclipse
P.S:everything else works perfectly .I am just missing this section.
The instructions you were looking at were probably from R20 or earlier versions of the Android Developer Tools. R21 is different and appears to be what you are running. You change the behavior of the hardware buttons on the Device Definitions tab for whatever device is associated with your AVD:
Change the Buttons drop-down to Software or Hardware depending on what you want the behavior to be.
After lengthy trial and error, I banished the "hardware buttons not enabled in AVD" problem by discovering that there are at least three distinct 'gotchas' that must be set properly. I am using Eclipse Java EE Juno with ADT version 22.3.0 (latest as of 2013 Nov 3).
In summary, it's a bit awkward to figure out the first time, but simple thereafter. The virtual device definition must include 1) hardware buttons, 2) the device definition must also be chosen in the AVD selector drop down field, and 3) the box must be ticked for displaying a skin with hardware controls. All three are critical. Step by step:
Window → Android Virtual Device Manager (See screen capture below) (NOTE: If not visible in menu, choose Window → Customize Perspective and tick Android SDK and AVD manager - but assume this has already been done if you have gotten far enough to get the above error message)
Click the first tab, which is Android Virtual Device, click Edit, and note the name of the Device listed in the second combo box field from the top. This is going to be either a built in default Android virtual device definition, or a custom one you have created (or will create) from scratch. Make note of this Device name and close Edit Android Virtual Device edit window by clicking "OK"
Click the second tab in Android Virtual Device Manager which is Device Definitions and select the device you remember from step #2 above from the list (Note to emulator developers - this setup step is slightly more awkward than necessary - perhaps tabs one and two could be tied together more closely to allow double clicking a device and editing it directly instead of having to close a tab then opening another). After selecting the virtual device definition, choose Edit (or Clone if the device you want to edit is a built-in definition because if it is a built-in device, it must be saved as a cloned copy once edited. Name the cloned device something memorable in the top left field of the Clone Device window, e.g. add "_hardwareButtons" to the end of the default name).
IMPORTANT: Edit the cloned device: Ensure that Buttons → Hardware is chosen on the right hand side, fourth field down, of the Edit Device (or Clone Device) window (from step #3 above under Device Definitions tab). This is critically important or the Hardware buttons will not be active. This is the most likely root cause of the above error message. It's OK to leave Input as No Nav unless you want to use the virtual DPad. Click Edit Device (or Clone Device) at the bottom right of the window to save your changes.
IMPORTANT: Inside Android Virtual Device manager, click first tab again, which is Android virtual device. Select Edit and ensure that the newly edited, created, or cloned device is selected by name in the Device field drop down combo box (second from top) of the AVD. (see top two screen captures above). It is critically important that the proper device is chosen here, because creating a newly cloned device does not automatically update, or associate it with, your AVD (see my comments to emulator developers above).
IMPORTANT: Also inside the same Android Virtual Device edit box, Make sure Skin → Display a skin with hardware controls is ticked. This is also critically important or you will not see any hardware buttons at all. Click "OK" to close Edit window.
For good measure (possibly unnecessary) I clicked Refresh in the first tab (Android Virtual Device) of AVD manager and looked to be sure that a green checkmark was in front of the AVD I just edited. If not, it's probably because the newly edited device is not yet connected with your AVD. Click Edit and again choose the proper newly edited device name. Click "OK" to close.
In addition and optional for the truly paranoid, you can click Details under AVD first tab and expand the window to look at your device definition specifics. Make sure that skin.dynamic is yes, hw.keyboard: is no (unless want keyboard) and hw.mainKeys: is yes and hw.dPad: is no (unless want dPad) and, as always, ensure that you have the proper device name chosen.
Now you should have a perfectly viable AVD defined that you can use in the RUN → RUN CONFIGURATION Eclipse menu and it will not display the dreaded "hardware buttons not enabled in AVD" error message.
In Eclipse, RUN → RUN CONFIGURATION, choose your app name from the left hand side (and make sure it also appears under Android tab) and that the newly defined AVD is ticked under the Target tab and click RUN. (or CTRL+F11 after the first run of any new configuration).
Here are some screen captures from a tablet emulator as an example:

Android 3.0 emulator only showing a fraction of the app when loaded

So I've searched for an answer but found nothing. Basically, whenever I run a simple little menu app for android tablets using the eclipse android emulator 3.0, only about 1/6th of the app is shown (the top center piece, if the tablet is held landscape.) I've done tutorials using the 2.2 emulator and they work just fine, but whenever I launch the 3.0, the app (and only the app - the android home runs fine) just doesn't appear. When I look at it in the main.xml layout folder, the graphical layout shows it exactly the way I want it to appear.
Is this a problem with the emulator? This can't be a common problem, otherwise I'm sure I would have found a solution by now, but there must be some switch or something that I'm not seeing that's making the app appear as if it were running on a phone and not a tablet.
Do you have a low resolution set for your 3.0 AVD? If you run the AVD Manager, what resolution does it show?

Categories

Resources