草庐IT

android - 渲染和ActionBar Overlay布局错误

coder 2023-11-29 原文

我在 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计算器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>

其余的 Activity 文件都是同样的问题

最佳答案

我有同样的错误。在我的 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

关于android - 渲染和ActionBar Overlay布局错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47829828/

有关android - 渲染和ActionBar Overlay布局错误的更多相关文章

  1. ruby-on-rails - Rails 常用字符串(用于通知和错误信息等) - 2

    大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje

  2. ruby-on-rails - 渲染另一个 Controller 的 View - 2

    我想要做的是有2个不同的Controller,client和test_client。客户端Controller已经构建,我想创建一个test_clientController,我可以使用它来玩弄客户端的UI并根据需要进行调整。我主要是想绕过我在客户端中内置的验证及其对加载数据的管理Controller的依赖。所以我希望test_clientController加载示例数据集,然后呈现客户端Controller的索引View,以便我可以调整客户端UI。就是这样。我在test_clients索引方法中试过这个:classTestClientdefindexrender:template=>

  3. ruby-on-rails - Rails HTML 请求渲染 JSON - 2

    在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这

  4. ruby-on-rails - 迷你测试错误 : "NameError: uninitialized constant" - 2

    我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test

  5. ruby-on-rails - 如何在 Rails View 上显示错误消息? - 2

    我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c

  6. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  7. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  8. ruby - #之间? Cooper 的 *Beginning Ruby* 中的错误或异常 - 2

    在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee

  9. ruby-on-rails - 每次我尝试部署时,我都会得到 - (gcloud.preview.app.deploy) 错误响应 : [4] DEADLINE_EXCEEDED - 2

    我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie

  10. ruby-on-rails - Rails 5 Active Record 记录无效错误 - 2

    我有两个Rails模型,即Invoice和Invoice_details。一个Invoice_details属于Invoice,一个Invoice有多个Invoice_details。我无法使用accepts_nested_attributes_forinInvoice通过Invoice模型保存Invoice_details。我收到以下错误:(0.2ms)BEGIN(0.2ms)ROLLBACKCompleted422UnprocessableEntityin25ms(ActiveRecord:4.0ms)ActiveRecord::RecordInvalid(Validationfa

随机推荐