gpt4 book ai didi

android - 添加 Android Studio 3.0 的布局编辑器工具栏和上下文菜单中缺少的(垂直/水平)障碍

转载 作者:太空宇宙 更新时间:2023-11-03 13:09:55 26 4
gpt4 key购买 nike

我指的是在 https://developer.android.com/training/constraint-layout/index.html#constrain-to-a-barrier 上使用约束布局的指南亲 body 验 Barriers。

步骤说,

To create a barrier, follow these steps:

Click Guidelines in the toolbar, and then click Add Vertical Barrier or Add >Horizontal Barrier.

而当我点击 Guidelines 图标时,它只显示两个选项,即

  1. 添加垂直引用线
  2. 添加水平引用线

即使上下文菜单也不显示添加 Barrier 的选项。


已经有相同上下文的问题Add Constratint Layout Barriers Missing In Context Menu of Android Android Studio但对于由 CommonsWare 回答的 Android Studio 2.3.3。

通过评论与 CommonsWare 进行了讨论,他建议使用 ConstraintLayout 1.1 的测试版

但根据 training guide对于使用 ConstraintLayout,constraintLayout 版本是 1.0.2

dependencies { compile 'com.android.support.constraint:constraint-layout:1.0.2' }

甚至 Android Studio 3.0 release notes表示现在支持创建障碍选项(添加组除外,它需要 ConstraintLayout 1.1.0 beta 2 或更高版本)。

screenshot of Android Studio 3.0 release notes

环境细节:

Android Studio 3.0.1Build #AI-171.4443003, built on November 9, 2017JRE: 1.8.0_152-release-915-b01 amd64JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.oWindows 8.1 6.3Constraint Layout :1.0.2Graddle wrapper : gradle-4.1buildToolsVersion : 26.0.2

最佳答案

根据 this documentation ConstraintLayout 的 1.1.0-beta1 版中引入了障碍。 (重点是我的)

Bugfixes related to wrap_content

New features: barriers, placeholder, percent dimensions

由于屏障是在 1.1.0-beta1 中引入的,因此您不会在任何早期版本中看到它们。

我目前正在运行带有 ConstraintLayout 1.1.0-beta3 的 Android Studio 3.0.1,这是我在设计器中按下指南按钮时看到的:

enter image description here

上下文菜单还将障碍显示为一个选项。

因此,简而言之,您需要 Android Studio 3.0+ 和 ConstraintLayout 版本 1.1.0-beta1 或更高版本才能看到这些选项。

关于android - 添加 Android Studio 3.0 的布局编辑器工具栏和上下文菜单中缺少的(垂直/水平)障碍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47596214/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com