0

Elements are not showing in the design editor android studio.

I have added image views in the layout editor but it is showing up in the editor. I have also tried to change theme types but still it's not working. I have also tryed changing the layout type.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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"
    android:id="@+id/relativeLayout">


    <GridLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/board"
        android:columnCount="3"
        android:rowCount="3"
        tools:targetApi="ice_cream_sandwich"
        tools:layout_conversion_absoluteHeight="0dp"
        tools:layout_editor_absoluteY="0dp"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_conversion_absoluteWidth="0dp">

        <ImageView
            android:id="@+id/imageView8"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_alignParentBottom="true"
            android:layout_column="0"
            android:layout_marginLeft="27dp"
            android:layout_marginTop="10dp"
            android:layout_row="0"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView7"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_alignParentBottom="true"
            android:layout_column="2"
            android:layout_marginLeft="35dp"
            android:layout_marginTop="10dp"
            android:layout_row="0"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView6"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_alignParentBottom="true"
            android:layout_column="0"
            android:layout_marginLeft="10dp"
            android:layout_row="1"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView5"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_alignParentBottom="true"
            android:layout_column="1"
            android:layout_marginLeft="27dp"
            android:layout_row="1"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView4"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_alignParentBottom="true"
            android:layout_column="2"
            android:layout_marginLeft="35dp"
            android:layout_row="1"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_column="0"
            android:layout_marginLeft="10dp"
            android:layout_row="3"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_column="1"
            android:layout_marginLeft="27dp"
            android:layout_row="2"
            android:contentDescription="TODO"
            android:src="@drawable/red"
            android:layout_marginStart="27dp" />

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_column="0"
            android:layout_margin="10dp"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:layout_row="0"
            android:contentDescription="TODO"
            android:src="@drawable/red" />

        <ImageView
            android:id="@+id/imageView9"
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:layout_alignParentBottom="true"
            android:layout_column="2"
            android:layout_marginLeft="35dp"
            android:layout_row="2"
            android:contentDescription="TODO"
            android:src="@drawable/red" />
    </GridLayout>
</RelativeLayout>
EzLo
  • 13,780
  • 10
  • 33
  • 38
Goku
  • 59
  • 1
  • 8
  • 2
    You should share the exact error message as text. [Edit] the question and make sure these details are present. –  Aug 22 '18 at 19:32
  • jdv the app is compiling and running in emulator but the elements and components are not showingup in design preview there is no error in the app – Goku Aug 23 '18 at 00:54
  • You need to provide more information. "It is not working" is not enough to help you. See [ask]. –  Aug 23 '18 at 13:51

1 Answers1

0

Go to the project view on the left side of android studio.

Then select app-> res-> values-> styles :

Inside the styles.xml file you'll find something like this :

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

Change it to :

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Simply add "Base." before Theme and the design view should work just fine.

Kazi
  • 381
  • 2
  • 13