Reputation: 3397
I don't want set visibility programmatically and I make it in xml files, but when I set visibility property to GONE view hides from preview screen. Sometimes I need to correct some field in gone views and I must change visibility to VISIBLE, make changes and change visibility back. It's annoying.
How to make view with visibility GONE visible ONLY in Android Studio preview.
Upvotes: 6
Views: 1220
Reputation: 1106
There is indeed a simple way to do that:
Define the tools
attribute in your main Layout:
xmlns:tools="http://schemas.android.com/tools"
Use it to make your element visible, like you normally would:
tools:visibility="visible"
Upvotes: 11