Jan Slominski Jan Slominski - 1 year ago 219
Android Question

Problems with Layout Editor in Android Studio 2.2.1 using Constraint Layout

I'm having trouble with Android Studio's Layout Editor after updating to Android Studio 2.2.1 (from stable channel). The editor is sometimes hiding "Constraint Layout" controls from the UI, as shown on the screenshots below:


I'm using Constraint Layout alpha 9 and Data Binding hence the layout is wrapped in "layout" tag. Here is the code for example layout:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">



The controls are disappearing and appearing when I add/remove elements from the layout. Is this a bug in the new Android Studio or Constraint Layout? Or am I doing something wrong?

Answer Source

Let's call that a bug :)

(I just filed it here: https://code.google.com/p/android/issues/detail?id=224973)

What's happening is that we only show the controls that can apply to the current selection, or the root if things aren't selected. Because of the layout tag, the root isn't a ConstraintLayout, so we don't show the controls until you select an element. This is an issue you will encounter too if you embed a CL inside another layout, but at least in the case of databinding we probably should behave as if root was the CL element.

Thanks, we'll try to fix this asap.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download