问题标签 [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 投票
3 回答
2764 浏览

android - 约束布局 - 以编程方式设置方向的指南

是否可以从新的 ConstraintLayout 以编程方式设置 Guideline 的方向?

我正在使用这个版本的 ConstraintLayout 库:

如果你反编译 ConstraintLayout 类,你可以看到 LayoutParams 有字段“orientation”,但它不是一个公共字段,也没有 setter 方法。

0 投票
0 回答
155 浏览

android - 是否可以在没有 Android Studio 2.2 预览的情况下使用约束布局?

是否可以在没有 Android Studio 2.2 预览版的情况下使用约束布局,或者我必须安装预览版才能对其进行测试?

0 投票
1 回答
1085 浏览

android - 如何在 Android 中以编程方式更改作为 ConstraintLayout 子视图的约束?

如何在 Android 中以编程方式更改作为 ConstraintLayout 子视图的约束?我找不到任何有用的文档。我什至找不到源代码或 API 文档。

0 投票
1 回答
433 浏览

android - 无法在 ConstrainLayout 编辑器中打开属性视图

我有ConstraintLayout编辑器的问题。我在 Linux 上使用Android Studio 2.2 preview 4,ConstrainLayout 版本 1.0.0-alpha3。

简单地说,我无法打开属性视图。我想知道这是否是我使用 Linux 构建的某种情况,或者什么。我在任何地方都找不到关于那的任何信息。我的朋友使用 Mac(也是预览版 4)可以打开该视图。

有一些屏幕截图: 在此处输入图像描述

在此处输入图像描述

0 投票
2 回答
6463 浏览

android - ConstraintLayout with DataBinding incorrect width in RecyclerView

I am trying to play around with new ConstraintLayout. And I made the layout for my RecyclerView's row. It has ConstraintLayout as root element which width is set to match_parent and when I run my app it renders just as expected

correct width

It works well until I put data binding section in my XML and the root element henceforth is layout tag which wraps ConstraintLayout and it results in some unpredictable change in behavior of ConstraintLayout - it's width henceforth doesn't renders as match_parent, it only takes small part of display width, though it's still set to match_parent in XML. I also tried to set width to some fixed value and the result was the same

enter image description here

I suspect that Data Binding processor kinda strips attributes from ConstrainLayout when process layouts during the build process. Is there any way to get things work correctly? My layout

And adapter:

0 投票
4 回答
18892 浏览

android - 窗口软输入模式 ConstraintLayout

之前软输入模式没有问题,但是在 include 之后ConstraintLayout,出现键盘时片段的内容并没有上移。

显现

分段

布局

这是理解的图片:

在此处输入图像描述

我怎么能理解发生了什么?我以前使用过 ViewTreeObserver。

UPD

我的目标是

在此处输入图像描述

我希望当键盘出现时内容会向上移动,但键盘却与它重叠。

0 投票
1 回答
1487 浏览

android - 如何使 ConstraintLayout 为 RTL 正常工作?

有人知道为什么在切换到 rtl 时,ConstraintLayout 会居中所有元素吗?

android:supportsRtl="true"在清单中设置。

BookShelfActivity.java仅包含标准 onCreate 覆盖:

这是活动xml:

在此处输入图像描述

0 投票
3 回答
1696 浏览

android - CircleCI 找不到 com.android.support.constraint:constraint-layout:1.0.0-alpha3

我已经尝试了很长时间让 ConstraintLayout 与 CircleCI 一起工作。以前它显示我尚未接受 SDK 许可证,因此我将 Android SDK 许可证导出到 CircleCI。(线程是在这里创建的)现在我面临另一个错误,它说:

我很困惑,所以我通过在依赖项中运行以下命令打印出m2repository中的所有文件:pre:

它在那里向我显示约束文件夹:

有没有人遇到过这个问题?请帮忙。

有关更多信息,这是我的 .yml 文件:

0 投票
1 回答
640 浏览

android - 任何大小时在约束布局中显示错误的 TextView

我不知道这是否是一个错误,但如果你尝试这种布局:

文本显示不正确。我认为预期的行为会是这样的:

有没有办法在不为父级设置填充的情况下实现与相对布局相同的结果?我在用着com.android.support.constraint:constraint-layout:1.0.0-alpha4

0 投票
2 回答
1897 浏览

java - 使用 ConstraintsLayouts 设计不同的屏幕尺寸

我已经开始深入研究今年在 IO 上宣布的约束布局。这看起来很有前途,并使您的布局非常有效。我看过 Google 提供的 codelab excersize。但是,我有以下问题想要解决。

  1. 如何使用ConstraintLayouts来设计不同屏幕尺寸的布局?

目前我为特定的设备/屏幕组设计布局并设置视图的边距和填充等。将这些值保存在dimens.xml文件中。这是设计布局的一种非常痛苦的方法。Android ConstraintsLayout在设计多屏时是否也模仿了iOS 的AutoConstraintsLayout ?

  1. 为不同的屏幕方向设计布局是否仍然需要不同的 Layout.xml 文件,即;layout_landscape.xmllayout_portraint.xml