Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in rendering and ActionBar Overlay layout

I have opened a project in android studio and i tried to preview the design and here is the problem, the rendering has some error and it shows actionBar overlay layout how can i fix this problem

here is my build.gradle file

    buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.2'

    defaultConfig {
        applicationId "development.assistant.project.s_assistant"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:support-annotations:27.0.1'
}

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
    google()
}

this is a screenshot

error in rendering

here is gpa calculator xml file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.assistant.learn.assistant12.Calculator.Cgpa">
<RelativeLayout
    android:layout_width="match_parent"
    android:background="#ffffff"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="14dp"
        android:text="   ENTER YOUR SGPA  "
        android:textColor="#000000"
        android:textSize="20sp"/>


    <EditText
        android:id="@+id/c4"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:hint="S5"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/c3"
        android:layout_alignLeft="@+id/c3"
        android:layout_alignStart="@+id/c3"
        android:layout_alignRight="@+id/c3"
        android:layout_alignEnd="@+id/c3" />

    <EditText
        android:id="@+id/c5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="S6"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/c4"
        android:layout_alignLeft="@+id/c4"
        android:layout_alignStart="@+id/c4"
        android:layout_alignRight="@+id/c4"
        android:layout_alignEnd="@+id/c4" />

    <EditText
        android:id="@+id/c7"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:hint="S8"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/c6"
        android:layout_alignLeft="@+id/c5"
        android:layout_alignStart="@+id/c5"
        android:layout_alignRight="@+id/c6"
        android:layout_alignEnd="@+id/c6" />

    <EditText
        android:id="@+id/c6"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:hint="S7"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/c5"
        android:layout_alignRight="@+id/c5"
        android:layout_alignEnd="@+id/c5"
        android:layout_alignLeft="@+id/c5"
        android:layout_alignStart="@+id/c5" />

    <EditText
        android:id="@+id/c2"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:hint="S3"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/c1"
        android:layout_alignLeft="@+id/c1"
        android:layout_alignStart="@+id/c1"
        android:layout_alignRight="@+id/c1"
        android:layout_alignEnd="@+id/c1" />

    <EditText
        android:id="@+id/c1"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:hint="S1S2"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/textView2"
        android:layout_alignLeft="@+id/textView2"
        android:layout_alignStart="@+id/textView2"
        android:layout_alignRight="@+id/textView2"
        android:layout_alignEnd="@+id/textView2">

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/c3"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:hint="S4"
        android:ems="10"
        android:inputType="numberDecimal"
        android:layout_below="@+id/c2"
        android:layout_alignLeft="@+id/c2"
        android:layout_alignStart="@+id/c2"
        android:layout_alignRight="@+id/c2"
        android:layout_alignEnd="@+id/c2">
    </EditText>

    <Button
        android:id="@+id/b3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="FIND"
        android:textStyle="bold"
        android:textSize="16dp"
        android:background="@color/colorPrimaryDark"
        android:textColor="#ffffff"
        android:layout_below="@+id/c7"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp" />

</RelativeLayout>
</RelativeLayout>

the rest of activity files just the same problem

like image 463
younis Avatar asked Dec 15 '17 09:12

younis


People also ask

What is ActionBar in android?

The app bar, also known as the action bar, is one of the most important design elements in your app's activities, because it provides a visual structure and interactive elements that are familiar to users.

Where is ActionBar in android?

Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.

How do I add an action bar?

To generate ActionBar icons, be sure to use the Asset Studio in Android Studio. To create a new Android icon set, right click on a res/drawable folder and invoke New -> Image Asset.


1 Answers

I had the same error. In my styles.xml I changed

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

to

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

I learned it here:

Android Studio layout design view shows overlay after upgrade to v3.0

like image 157
Klaus Avatar answered Sep 22 '22 10:09

Klaus