我正在尝试使用新的约束布局占位符,但是由于如果将宽度/高度值(非0)提供给占位符,它将无法正常工作,我遇到了麻烦。
这是我的子视图,应该将视图注入模板。请注意,宽度和高度设置为match_constraint和wrap_content
const HocComponent = Hoc({
key1: () => ({
prop1: 'value1',
}),
key2: () => ({
prop2: 'value2',
}),
})(Component);
<HocComponent /> // Error! prop3 is required
<HocComponent prop3={true} /> // Happy again
这是我用于占位符的代码
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/dialog_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:layout_height="30dp" />
<include
layout="@layout/view_full_screen_dialog_template"/>
</android.support.constraint.ConstraintLayout>
正如您所看到的,我也将laout_height也设置为wrap_content,这(某种程度上)迫使设计器中的布局在整个视图中都被拉伸。
问题在于文本视图的行为简直很奇怪,被剪切了,仅吸收了2dp的内容。如果我将占位符的宽度/高度设置为0dp,它将正常工作。
TL; DR占位符的宽度/高度值可以不同于0才能正常工作吗?可以覆盖它们吗?