Sharing a new image of the problem
Asked
Active
Viewed 61 times
-1
-
check the render error. in preview screen there will be red sign if there is an error. it will guide you to the correct issue. – Pragnesh Ghoda シ Jun 27 '18 at 09:32
-
I edit the thread with an image of that. Thanks for the info!. – Xabriel Nsg Jun 27 '18 at 13:54
-
Already fixed thanks for the help i didnt see the red error button ! https://stackoverflow.com/questions/44223687/render-error-in-android-studio-3-0-layout-editor#45002903 – Xabriel Nsg Jun 27 '18 at 14:08
2 Answers
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
-
-
Can you try to add `android:textColor="#000000"` attribute to the TextView ? – SamyB Jun 26 '18 at 14:55
-
-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
-
-
Can you share the error displayed in xml file on top right **red** color. – Jay Thakkar Jun 27 '18 at 06:28
-
-
-
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