Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - How to add a Screen Size Definition

I am building an Android Application using Android Studio.

I want my layout to be as precise as possible, however, it seems that the list of Android Virtual Devices where we can render the layout to is limited to Nexus Devices as shown in this screenshot below:

Device List

and the "Generic Phones and Tablets" do not have much screen size and resolution variety, so I decided to add my device definition as such:

My Device

However, it did not appear in the devices that Android Studio can render a layout to in the Design view of a layout.

Solved

After restarting Android Studio, the newly created AVD (Samsung Galaxy Note 1) now appeared in my list of devices that I can preview the rendering to when I view my layout.

I think all I had to do was to restart Android Studio for it to appear. It works now.

like image 829
Razgriz Avatar asked May 04 '15 03:05

Razgriz


People also ask

How will you define screen layout in Android?

Android Layout is used to define the user interface that holds the UI controls or widgets that will appear on the screen of an android application or activity screen. Generally, every application is a combination of View and ViewGroup.

How do I manage screen size on Android?

The best way to create a responsive layout is to use ConstraintLayout as the base layout in your UI. ConstraintLayout enables you to specify the position and size of each view according to spatial relationships with other views in the layout. All the views can then move and resize together as the screen size changes.

Why is it problematic to define size using pixels on Android?

Defining dimensions with pixels is a problem because different screens have different pixel densities, so the same number of pixels may correspond to different physical sizes on different devices.


1 Answers

The solution to this, is to restart Android Studio. The new devices should appear at the bottom of the list.

like image 157
Mike dg Avatar answered Oct 20 '22 11:10

Mike dg