79796685

Date: 2025-10-22 11:02:38
Score: 2
Natty:
Report link

I guess you need to change the margin of SurvivorLayout?

fun vislaSetRelativeLayoutMargin(systemBar: Insets, layout: RelativeLayout) {
    val params = layout.layoutParams as? ConstraintLayout.LayoutParams ?: return。//maybe more cases

    if (systemBar.left > params.leftMargin) {
        params.leftMargin = systemBar.left
    }
    if (systemBar.top > params.topMargin) {
        params.topMargin = systemBar.top
    }
    if (systemBar.right > params.rightMargin) {
        params.rightMargin = systemBar.right
    }
    if (systemBar.bottom > params.bottomMargin) {
        params.bottomMargin = systemBar.bottom
    }
    layout.layoutParams = params
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Jvsun