-1

Sharing a new image of the problem

enter image description here

2 Answers2

0

You should add in your activity layout the context and tools attributes on your RelativeLayout:

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

    ...

</RelativeLayout>

The context should be linked to your Activity.

Here some documentation => https://developer.android.com/studio/write/tool-attributes

SamyB
  • 235
  • 1
  • 9
-1
<?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"
    tools:showIn="@layout/activity_main">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

 class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

    }
Jay Thakkar
  • 1,392
  • 10
  • 19
  • I add a pic in the answers – Xabriel Nsg Jun 26 '18 at 14:42
  • Can you share the error displayed in xml file on top right **red** color. – Jay Thakkar Jun 27 '18 at 06:28
  • First i have a "REnder problem" – Xabriel Nsg Jun 27 '18 at 13:49
  • Failed to load AppCompat ActionBar with unknown error. – Xabriel Nsg Jun 27 '18 at 13:49
  • Then i have this "Failed to instantiate one class or more" The following classes could not be instantiated: - android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache) - android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache) - android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can – Xabriel Nsg Jun 27 '18 at 13:50
  • @XabrielNsg Please update below changes use: compile 'com.android.support:appcompat-v7:26.0.0' with: buildToolsVersion '26.0.0' and classpath 'com.android.tools.build:gradle:3.0.0-alpha8' everything will work fine. Also up vote if ans and comment is useful. – Jay Thakkar Jun 27 '18 at 14:04
  • I find a solution in this web https://stackoverflow.com/questions/44223687/render-error-in-android-studio-3-0-layout-editor#45002903 .. thanks for the help i didnt see the red error button ! – Xabriel Nsg Jun 27 '18 at 14:07