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

CoordinatorLayout

Hi there guys!! I have a problem, I´m trying to show a SnackBar on my layout, but the snack bar shows above the editText where the user inputs the message, how can I change this behaviour?

Here´s my code:

<?xml version="1.0" encoding="utf-8"?>

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:context=".MainActivity">

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/mainLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ListView
            android:id="@+id/message_listView"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_above="@+id/llSend"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:stackFromBottom="true"
            android:transcriptMode="normal" />


        <LinearLayout
            android:id="@+id/llSend"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="vertical"
            android:paddingBottom="10dp"
            android:paddingTop="5dp">



            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="50dp"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:background="@android:color/white"
                android:orientation="horizontal">

                <Chronometer
                    android:id="@+id/audioChronometer"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:format="%s"
                    android:paddingLeft="@dimen/activity_horizontal_margin"
                    android:textColor="@android:color/holo_red_light" />


                <EditText
                    android:id="@+id/userTextMessage"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/btMessage"
                    android:layout_toLeftOf="@+id/photoButton"
                    android:layout_toStartOf="@+id/photoButton"
                    android:imeOptions="actionSend"
                    android:inputType="textMultiLine|textShortMessage"
                    android:maxLength="800"
                    android:paddingRight="@dimen/activity_horizontal_margin"
                    android:textColorHint="#B6B6B6" />

                <ImageButton
                    android:id="@+id/photoButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_toLeftOf="@+id/btMessage"
                    android:background="#FFFFFF"
                    android:paddingRight="@dimen/activity_horizontal_margin" />

                <ImageButton
                    android:id="@+id/btMessage"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentTop="true"
                    android:gravity="center_vertical|right"
                    android:paddingLeft="50dp" />

                <ImageButton
                    android:id="@+id/btRecord"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentTop="true"
                    android:gravity="center_vertical|right"
                    android:paddingLeft="50dp" />

            </RelativeLayout>


        </LinearLayout>

        <ImageView
            android:id="@+id/deleteRecording"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginEnd="63dp"
            android:layout_marginRight="63dp"/>

    </RelativeLayout>

    </android.support.design.widget.CoordinatorLayout>