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 (2014) Creating the Screen Layout Adding a TextView

Costi Khamis
Costi Khamis
12,061 Points

I cant move the text or buttons in the layout editor.

I have a windows computer. when I drag any button or text view, they end up on the top of top of the screen.

Kate Hoferkamp
Kate Hoferkamp
5,205 Points

What does your xml view code look like?

Kate Hoferkamp
Kate Hoferkamp
5,205 Points

Glad you got it sorted=]

2 Answers

Daniel Hartin
Daniel Hartin
18,106 Points

Hi Costi

Is your layout a relative layout? if the layout is defined as LinerLayout you won't be able to drap and drop.

You should be able to check this easy enough in the XML code tab of your layout.

It should look similar to the code below with relative layout defined as the Parent (Top) layout. If it does say LinearLayout simply type in RelativeLayout, save then go to the graphical editor and drag and drop functionality should be restored.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.ribbit.MainActivity$PlaceholderFragment" >


    <TextView
        android:id="@android:id/empty"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/empty_friends_label"/>

</RelativeLayout>

Hope this helps

Daniel

David Franco
David Franco
3,252 Points

I had this problem also. If you are in the 2019+ version of Android Studio, then you need to click the horseshoe shaped icon above the app image. You will notice it has a line through it, when you click it, then the line will be removed and you are free to move the text wherever.