对于我在下面的XML中声明的上述布局,当view_2
为12dp
时,我试图使view_1
的起始边距默认为GONE
。想知道如何使用goneMargin*
实现它吗?当我有约束时,将app:layout_goneMarginStart="12dp"
设置为view_2
无效,就像我将小部件平均拉开的相反力(I am referring to this approach of positioning)]
<View
android:id="@+id/view_1"
android:background="@color/faded_green"
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</View>
<View
android:id="@+id/view_2"
android:background="@color/deep_red"
android:layout_width="100dp"
android:layout_height="50dp"
app:layout_constraintStart_toEndOf="@id/view_1"
app:layout_constraintEnd_toEndOf="@id/view_1"
app:layout_constraintTop_toTopOf="@id/view_1"
app:layout_constraintBottom_toBottomOf="@id/view_1">
</View>
对于我在下面的XML中声明的上述布局,当view_1为GONE时,我试图使view_2的起始边距默认为12dp。想知道如何使用godMargin *实现它吗? ...
您将必须以编程方式删除view_2