我在android studio中打开了一个项目,我试图预览设计,这里是问题,渲染有一些错误,它显示了actionBar叠加布局如何解决这个问题
这是我的build.gradle文件
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()
}
这是截图
这里是gpa calculator xml文件
<?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>
其余的活动文件只是同样的问题
答案 0 :(得分:14)
我有同样的错误。在我的styles.xml中,我改变了
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
到
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
我在这里学到了:
Android Studio layout design view shows overlay after upgrade to v3.0