Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Observable to track visibility changes #543

@mohsin

Description

@mohsin

I see that there is a consumer to set the view's visibility but I couldn't find an observable variant for the same. I'm trying to do something like this (for now I used a workaround but ideally an observable that emits visibility changes would be the best for this job):

secondItem.visibility()
  .subscribe ({ 
    if(it == View.VISIBLE) {
      (itemWhichShouldFillLayout.layoutParams as LinearLayout.LayoutParams).weight = 0.65f
    } else {
      (itemWhichShouldFillLayout.layoutParams as LinearLayout.LayoutParams).weight = 0.8f
    }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions