I got a view and in xml it is visible
<LinearLayout
android:id="@ id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
Then I do some manipulation with the data and I make it to invisible
container.visibility = INVISIBLE
But I have reset button that suppose to set the container back to visible after click
resetBtn.setOnClickListener {
this.runOnUiThread { // tried this from stack overflow answers
container.visibility = VISIBLE
container.invalidate()} // tried this from stack overflow answers
}
But after click I still do not see that container appears. What might be the issue?
CodePudding user response:
first of all, be sure that resetBtn is referred to exactly your desired XML file. it's better to use view binding instead of kotlin synthetic.
then try one of these lines in your click listener:
container.visibility = View.VISIBLE
or
container.isVisible = true
CodePudding user response:
Try to put log inside setOnClickLitener to check whether click works or not.If log message does not appear, it means you have problem with button