jjzjj

ConstraintLayout

全部标签

android - ConstraintLayout 稳定版?

在生产环境中使用ConstraintLayout是否安全?当前版本是beta4。'com.android.support.constraint:constraint-layout:1.0.0-beta4'命名测试版迫使我提出这个问题。谢谢。 最佳答案 Beta4应该相当稳定。布局的问题在于,如果它们适用于您的应用程序,它们就不会改变。我们正忙于下一个版本,它修复了一些极端情况问题并提高了性能。除了库,如果布局不是顶级布局,AndroidStudio2.2中的编辑器会出现问题。AndroidStudio2.3大幅改进。

android - ConstraintLayout 1.1.0 与 1.0.2 不同,这是一个错误吗?

如果我用1.0.2,3张图片的宽度是平均的,高度是我设置的radio计算出来的。如果我使用1.1.0,它们的高度是0dp并且我什么也看不到,除非我设置android:layout_height="match_parent"在根ConstraintLayout中。这是一个错误吗?这是我的代码: 最佳答案 根据theupdateddocument,布局行为在ConstraintLayout1.1.0中发生了变化:WRAP_CONTENT:enforcingconstraints(Addedin1.1)Ifadimensionissett

android - 在 gradle 中自动添加 ConstraintLayout 依赖

只是我更新了我的工作室(版本2.3)和构建版本('25.0.0'),现在,当我尝试创建新Activity时,constraintlayoutdependency会自动添加到我的build.gradle文件中。和布局呈现为父ConstraintLayout,有谁知道如何在创建Activity时删除此依赖项。在Activity创建gradle代码之前。dependencies{compile'com.android.support:support-v4:23.2.1'}在Activity创建gradle代码之后。dependencies{compile'com.android.suppor

android - 设置 ConstraintLayout 组的 alpha 值

我想问一下是否可以更改约束组的alpha?现在,如果我将visibility标签设置为visible/gone,它就会生效,但alpha标签似乎不起作用。 最佳答案 Group仅用于控制引用ID在app:constraint_referenced_ids中的可见性。根据documentation.组的可见性将应用于引用的小部件。这是一种轻松隐藏/显示一组小部件的便捷方法,而无需以编程方式维护这组小部件。 关于android-设置ConstraintLayout组的alpha值,我们在St

Android Studio ConstraintLayout alpha 9 onMeasure 错误

我正在使用ConstraintLayoutalpha9来构建我的布局当我使用alpha8时它说布局过时但是当我更新到alpha9时我会出现onMeasure错误这是错误代码java.lang.NoSuchMethodError:android.support.constraint.solver.widgets.ConstraintWidget.setHorizontalWeight(F)Vatandroid.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:675)atand

android - 如何在 Constraintlayout 中给 Group 背景色

我在约束布局中对3个TextView进行了分组。我有小组的背景,但它不起作用。还有没有其他回合可以做。 最佳答案 根据documentation,Group仅用于控制一组小部件的可见性。您可以将背景设置为View并将View限制为您希望背景出现的方式。在下面的代码示例中,在将背景设置为ID为background的View之后,我将View的顶部、左侧和右侧限制为parent和View底部到组中的最后一个TextView,在本例中是ID为textView3的TextView>。我还在textView3中添加了一个16dp底部填充,这样

android - 如何在 ConstraintLayout 中将一对 View 居中?

如何在ConstraintLayout中将一对View居中,如下所示,没有嵌套?它们需要接触并作为一个整体居中。我尝试将它们锚定到彼此和它们的父对象上,但后来它们没有相互接触,所以我为两者添加了水平偏差,但没有帮助。提前致谢... 最佳答案 您需要为链头设置chainstyle属性,即水平链左侧的第一个View。将给出预期结果的样式是packed。在这种情况下不需要偏差。 关于android-如何在ConstraintLayout中将一对View居中?,我们在StackOverflow上

android - 迁移到androidx : Didn't find class "androidx.constraintlayout.ConstraintLayout" on path: DexPathList后

如问题标题所示,我已经搜索了我的问题的答案,并找到了Errorinflatingclassandroidx.constraintlayout.ConstraintLayoutaftermigrationtoandroidx,这与MigratingtoAndroidX中提供的官方迁移说明一致.我收到的信息要求我将android.support.constraint.ConstraintLayout更改为androidx.constraintlayout.widget.ConstraintLayout,但这对我不起作用。我还没有找到关于在我的gradle文件中放置什么依赖项的任何信息,所以

android - ConstraintLayout 测量它的每个 child 多少次?

RelativeLayout测量其所有子项两次。这可能会导致性能问题。约束布局是否只测量其子节点一次? 最佳答案 ConstraintLayout最多需要两次测量。如果您查看ConstraintLayout的源代码,您会看到它的onMeasure()方法首先在internalMeasureChildren()实用方法。接下来,它评估一些约束。最后,ConstraintLayout在循环内第二次对其子项调用child.measure()。来源:反编译的类文件,因为此时源不可用。 关于and

android - RecyclerView 中带有 DataBinding 的 ConstraintLayout 宽度不正确

我正在尝试使用新的ConstraintLayout。我为我的RecyclerView行做了布局。它以ConstraintLayout作为根元素,宽度设置为match_parent,当我运行我的应用程序时,它会按预期呈现在我将数据绑定(bind)部分放入我的XML之前,它运行良好,此后根元素是包装ConstraintLayout的layout标记,它会导致ConstraintLayout的行为发生一些不可预测的变化-从此以后它的宽度不会't呈现为match_parent,它只占显示宽度的一小部分,尽管它在XML中仍然设置为match_parent。我也尝试将宽度设置为某个固定值,结果是一