0

I've been trying to run a simple example project in Android Studio. The problem is that every single element I create in the project does not appear in the design. I tried to fix the constraint but the result is the same. This is the very simple empty activity from the SDK.

<?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:context=".MainActivity">

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    android:visibility="visible"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Button"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toStartOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>

package com.app.aleatorio.aleatorio;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
0xCursor
  • 2,242
  • 4
  • 15
  • 33
Geeh Oliveira
  • 103
  • 2
  • 8

2 Answers2

0

That May be a Rendering problem. You can Solve this by changing the app theme.

Click on App Theme and select Holo Light then click OK.

Check this for more info Blank screen in android preview

Sharon P Raju
  • 76
  • 1
  • 7
0

I think you should take a look at your target sdk, minimum sdk version and compile sdk version. They should match or at least be compatible. Here is a short excerpt:

http://www.dummies.com/web-design-development/mobile-apps/the-compile-sdk-minimum-sdk-and-target-sdk-versions/

David Enoma
  • 311
  • 1
  • 13