Reputation: 9544
I am using data binding in my xml layout, I need to hide some views when user click on a button and its working perfectly fine.
Problem is that I need to place other views to places where hidden views were placed. But while editing layout in layout editor its showing all the layouts. How can I force editor to hide all those views that are bind with dynamic visibility, so I can place new views.
Here is what i am doing in my layout
<data>
<import type="android.view.View" />
<variable
name="isInEditState"
type="Boolean" />
</data>
this is how I set visibility which is working fine when I run app
android:visibility="@{isInEditState ? View.VISIBLE : View.GONE}"
Upvotes: 0
Views: 417
Reputation: 1596
Use tools:visibility="invisible"
or tools:visibility="gone"
to the views whose visibility is bound to databinding to not to show up in the layout editor
Ps: On adding this attribute if you get any error, just add the required namespace(toolsNs
) by pressing alt+enter
Upvotes: 1