问题标签 [android-constraintlayout]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5613 浏览

android - Android Studio 下载约束布局失败

我将 Android Studio 更新到 2.1.2,我想下载constraint-layout工具,但它会抛出此消息

要安装: - com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3 (extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha3) - com .android.support.constraint:constraint-layout:1.0.0-alpha3 (extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha3)

安装 com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3 Maven 包路径必须以 m2repository 开头 安装 com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3 失败!

安装 com.android.support.constraint:constraint-layout:1.0.0-alpha3 Maven 包路径必须以 m2repository 开头 安装 com.android.support.constraint:constraint-layout:1.0.0-alpha3 失败!

失败的包: - com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3 (extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha3) - com .android.support.constraint:constraint-layout:1.0.0-alpha3 (extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha3)

有没有人跟我有同样的问题?如果是,您是如何解决的?

编辑

我的操作系统是 Ubuntu 16.04

0 投票
1 回答
315 浏览

android - ConstraintLayout 中可调整大小的小部件

我有一个ListView三个组件水平对齐的项目:

  1. 一个ImageView包含一个图标
  2. 一个TextView带标题的
  3. 另一个ImageView机智的状态图标

目前,我通过 a 安排它们,RelativeLayout而我TextView的是“有弹性的”。

是否可以在中创建相同的布局ConstraintLayout?基本上,我要问的是我是否可以创建 2 个固定长度的约束而不是百分比。

0 投票
0 回答
2574 浏览

android - 将工具栏添加到 ConstraintLayout

当我尝试添加任何内容时,组件树ToolBarConstraintLayout不显示任何内容,并且出现以下错误:

任何提示将不胜感激

0 投票
1 回答
23868 浏览

android - 设计 CardView 而它的 Parent 是 ConstraintLayout?

我在包含 Relativelayout 的 Cardview 中编辑 RelativeLayout 时搞砸了!ConstraintLayout 会将相对布局的 wrap_content 更改为 0 并添加工具:layout_editor_absoluteX="10dp" 相对布局内的所有 textview 将折叠 cardview 的右上角!(嵌套 CardView 中的元素与 CardView 之外的元素对齐)

任何关于使用 ConstraintLayout 设计 RelativeLayout 的指南都会非常完整,RelativeLayout 在使用 ConstraintLayout 时不能在任何地方使用?当 CardViews 是 ConstraintLayout 的子代时,在使用 RelativeLayout 时使用 CardView 的子代的指导方针是什么?

0 投票
1 回答
431 浏览

android-layout - 奇怪的约束布局行为

我想问你,如果你对约束布局有类似的问题。当片段元素包含 id 标记时,片段的格式不正确。

格式不正确的布局

我的活动只有一个在 xml 中定义的片段:

片段约束一约束布局:

直接在activity中使用fragment layout时,一切正常。

0 投票
2 回答
1776 浏览

android - 使用带有约束布局的设计支持库

我尝试使用 ConstraintLayout 中支持设计库中的 TextInputLayout,但出现错误:

如何使用 ConstraintLayout 实现与 support.design.widget.TextInputLayout 相同的功能?

完整版面在这里: http: //pastebin.com/TjC0FAdS

问题是:

0 投票
23 回答
151116 浏览

android - Gradle Sync 失败找不到约束布局:1.0.0-alpha2

问题 :

背景: Android Studio 2.2 P 1

0 投票
1 回答
30466 浏览

android - 为什么要选择约束布局,因为我们已经有了相对布局?

为什么要在 android 空活动的默认布局文件中RelativeLayout替换为。ConstraintLayout我需要知道我们为什么要使用ConstraintLayout,它为我们提供了哪些其他好处。

0 投票
2 回答
2714 浏览

android - 嵌套约束布局忽略外部约束

目前我正在尝试将两个约束布局相互嵌套。为此,我使用<include/>标签。我在那里看到的是内部约束布局忽略了外部约束布局的每个约束。为了使它更明显,我在内部约束布局周围画了一个边框:

在此处输入图像描述

为了尝试这些东西,我使用com.android.support.constraint:constraint-layout:1.0.0-alpha3.

我现在的问题是:我做错了什么还是它甚至是 alpha 版本的错误?

0 投票
2 回答
4334 浏览

android - ConstraintLayout 忽略约束

我有一个ConstraintLayout带有几个元素和两个按钮的。

我试图通过使用顶部和底部约束并使用偏差属性将按钮放在底部以获取底部/左/右对齐。

一切都在编辑器 ( Android studio 2.2 P3) 中正确显示,但是当我运行应用程序时,没有任何内容正确显示。

任何帮助都将不胜感激。

以下是相关章节layout XML

在编辑器中查看

运行时查看