Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App with Kotlin Creating the Screen Layout Setting a Fullscreen Theme

NameSpace tools vs android

I had put relative layout's background as this

 tools:background="@android:color/holo_blue_light"

It but it didnt work, I changed tools name space with android and it worked What is the difference between them I had added tools namespace tag to in relative layout. Here is my relative layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
//this worked    android:background="@android:color/holo_blue_light"
//this didnt work    tools:background="@android:color/holo_blue_light"
    tools:context="com.example.aalap.funfactkotlin.MainActivity">

1 Answer

Seth Kroger
Seth Kroger
56,414 Points

The 'tools' namespace will set the value for Android Studio's preview but not the actual app. This is useful when you need placeholders to help you see what the layout will be like. If your app, say, displayed data from an API over the internet it's useful to have placeholder text than blank text to see the layout, but you don't want the placeholder text in the app.

great, makes sense. Thank you Seth.