<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csl_target_select_clock_in_test"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ff0030"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.75"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_target_list_back_clock_in"
app:layout_constraintVertical_bias="0.6" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csl_target_select_clock_in"
android:layout_width="375dp"
android:layout_height="550dp"
android:layout_marginTop="150dp"
android:background="@drawable/bg_finish_today_clock_in"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
......
</androidx.constraintlayout.widget.ConstraintLayout>
private void setLayout(){
csl_target_select_clock_in_test.post(new Runnable() {
@Override
public void run() {
if(csl_target_select_clock_in==null)return;
ConstraintLayout.LayoutParams lp = (ConstraintLayout.LayoutParams) csl_target_select_clock_in.getLayoutParams();
lp.topMargin = csl_target_select_clock_in_test.getTop();
lp.width = csl_target_select_clock_in_test.getWidth();
lp.height = csl_target_select_clock_in_test.getHeight();
csl_target_select_clock_in.setLayoutParams(lp);
}
});
}