【问题标题】:Problems with Layout Editor in Android Studio 2.2.1 using Constraint LayoutAndroid Studio 2.2.1 中使用约束布局的布局编辑器问题
【发布时间】:2016-10-11 10:01:43
【问题描述】:

我在更新到 Android Studio 2.2.1(来自稳定频道)后遇到了 Android Studio 的布局编辑器问题。编辑器有时会从 UI 中隐藏“约束布局”控件,如下面的屏幕截图所示:

我正在使用约束布局 alpha 9 和数据绑定,因此布局包含在“布局”标签中。这是布局示例的代码:

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

    <data>
        <variable
            name="viewModel"
            type="my.package.name.DashboardViewModel"/>
    </data>

    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </android.support.constraint.ConstraintLayout>
</layout>

当我从布局中添加/删除元素时,控件会消失并出现。这是新的 Android Studio 或约束布局中的错误吗?还是我做错了什么?

【问题讨论】:

    标签: android android-layout android-databinding android-studio-2.2 android-constraintlayout


    【解决方案1】:

    我们称其为错误:)

    (我刚刚在这里提交:https://code.google.com/p/android/issues/detail?id=224973

    发生的情况是,我们只显示可以应用于当前选择的控件,或者如果没有选择则显示根。由于布局标记,根不是ConstraintLayout,因此在您选择元素之前我们不会显示控件。如果您将 CL 嵌入到另一个布局中,这也是您会遇到的问题,但至少在数据绑定的情况下,我们可能应该将 root 视为 CL 元素。

    谢谢,我们会尽快解决这个问题。

    【讨论】:

      【解决方案2】:

      更新

      已在 Android Studio 2.3 beta 1 中解决。

      【讨论】:

        猜你喜欢
        • 2021-10-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-10
        • 1970-01-01
        • 2019-06-20
        相关资源
        最近更新 更多