Skip to content

Instantly share code, notes, and snippets.

@riggaroo
Last active November 2, 2015 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riggaroo/fd3199c043e02e399b5c to your computer and use it in GitHub Desktop.
Save riggaroo/fd3199c043e02e399b5c to your computer and use it in GitHub Desktop.
Example usage of the tools namespace for creating a meaningful Design View
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
tools:text="Rebecca Franks" />
@riggaroo
Copy link
Author

riggaroo commented Nov 2, 2015

Tired of creating dummy text strings in the strings.xml file? or want to see things in the Design View but its supposed to be hidden?

You can use the nifty tools namespace to make things visible for design purposes but have no affect in your app. Add the tools namespace to your XML file, and you can override things such as visibility and text.

Even though android:visibility is set to gone, using tools:visibility to visible, the view will be visible in the Design View but not in the real implementation. Very handy for complex layouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment