简体   繁体   English

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

[英]Add (Vertical/Horizontal) Barriers missing in layout editor toolbar and context menu of Android Studio 3.0

I was referring a guide on using Constraint layout at https://developer.android.com/training/constraint-layout/index.html#constrain-to-a-barrier to get hands on with Barriers. 我在https://developer.android.com/training/constraint-layout/index.html#constrain-to-a-barrier上引用了使用Constraint布局的指南,以便了解障碍。

The step says, 这一步说,

To create a barrier, follow these steps: 要创建屏障,请按照下列步骤操作:

Click Guidelines in the toolbar, and then click Add Vertical Barrier or Add >Horizontal Barrier. 单击工具栏中的“准线”,然后单击“添加垂直屏障”或“添加”>“水平屏障”。

Whereas when I clicked on Guidelines icon, it displayed only two options ie, 而当我点击指南图标时,它只显示两个选项,即

  1. Add Vertical Guideline 添加垂直指南
  2. Add Horizontal Guideline 添加水平指南

Even the context menu does not display option to add Barrier. 即使上下文菜单也不显示添加屏障的选项。


Already there is a question with same context Add Constratint Layout Barriers Missing In Context Menu of Android Android Studio but for Android Studio 2.3.3 which is answered by CommonsWare. 已经存在相同上下文的问题在Android Android Studio的上下文菜单中添加了Constratint布局障碍,但是对于Android Studio 2.3.3,CommonsWare会回答。

Had a discussion with CommonsWare through comments where he suggested to use beta of ConstraintLayout 1.1 . 通过评论与CommonsWare进行了讨论,他建议使用ConstraintLayout 1.1的beta

But as per the training guide for using ConstraintLayout the constraintLayout version is 1.0.2 但是根据使用ConstraintLayout的培训指南 ,constraintLayout版本是1.0.2

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

Even Android Studio 3.0 release notes says create barriers option is now supported (with an exception for Add Group, which requires ConstraintLayout 1.1.0 beta 2 or higher). 甚至Android Studio 3.0发行说明现在也支持创建障碍选项(Add Group除外,它需要ConstraintLayout 1.1.0 beta 2或更高版本)。

Android Studio 3.0发行说明的屏幕截图

Environment details : 环境细节:

Android Studio 3.0.1
Build #AI-171.4443003, built on November 9, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 8.1 6.3

Constraint Layout :1.0.2
Graddle wrapper : gradle-4.1
buildToolsVersion : 26.0.2

Per this documentation barriers were introduced in version 1.1.0-beta1 of ConstraintLayout . 根据此文档 ,在ConstraintLayout 1.1.0-beta1版本中引入了障碍。 (Emphasis is mine) (重点是我的)

Bugfixes related to wrap_content 与wrap_content相关的错误修正

New features: barriers , placeholder, percent dimensions 新功能: 障碍 ,占位符,百分比维度

Since barriers were introduced in 1.1.0-beta1, you will not see them in any earlier releases. 由于在1.1.0-beta1中引入了障碍,因此您不会在任何早期版本中看到它们。

I am currently running Android Studio 3.0.1 with ConstraintLayout 1.1.0-beta3 and this is what I see when I press the guidelines button in the designer: 我目前正在运行带有ConstraintLayout 1.1.0-beta3的Android Studio 3.0.1,这就是我在设计器中按下指南按钮时看到的内容:

在此输入图像描述

The context menu also shows barriers as an option. 上下文菜单还显示障碍作为选项。

So, in short, you need Android Studio 3.0+ and ConstraintLayout version 1.1.0-beta1 or later to see these options. 因此,简而言之,您需要Android Studio 3.0+和ConstraintLayout版本1.1.0-beta1或更高版本来查看这些选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM