Reputation: 81
I have an XML like:
<FrameLayout>
...
<include layout="..." id="@+id/myId">
...
</FrameLayout>
in my code however, it seems I cannot do something like
myId.setVisible(Visiblity.GONE)
This does not work for the <include>
but it works for regular TextView
for example. How can I approach this?
Upvotes: 0
Views: 200
Reputation: 1914
You should be able to toggle the visibility of the included layout.
Java
View myId = findViewById<View>(R.id.myId);
myId.setVisibility(View.GONE);
Kotlin
findViewById<View>(R.id.myId).visibility = View.GONE
The key differences in the my answer and OP are:
GONE
flag should come from the View
class instead of the Visiblity
.setVisible()
function should be setVisibility()
Upvotes: 1