-2

I am new to Android Studio, so I need a little help. I am working on 2.3.3. So the preview doesn't match the view that I get on the actual emulator. Please help.

Preview Image

enter image description here

Emulator Image

enter image description here

    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#006699"
    tools:context="a.myapplication.MainActivity">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="My App"
        android:textColor="#ffffff"
        android:textSize="85px"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="100dp"
        tools:layout_editor_absoluteY="264dp" />
</android.support.constraint.ConstraintLayout>
Syfer
  • 4,262
  • 3
  • 20
  • 37
Ankit Kathait
  • 105
  • 1
  • 12

1 Answers1

0

remove tools : attribute from xml as the only works in preview

  <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="My App"
        android:textColor="#ffffff"
        android:textSize="85px"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        />

This is good article for constraint layout

akshay_shahane
  • 4,423
  • 2
  • 17
  • 30