Android Studio?工具栏错误

时间:2018-07-14 16:55:31

标签: android android-studio

这是我的appbar_layout.xml。根据我的定义,它应该在顶部显示一个栏。但是它现在显示在“设计”选项卡中。但是,当我在android上运行它时,它会显示出来。可能是什么问题?

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_app_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.v7.widget.Toolbar>

我的项目bulid.gradle

     // Top-level build file where you can add configuration options common 
     to all sub-projects/modules.

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.0.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Design Tab Screenshot

1 个答案:

答案 0 :(得分:0)

我遇到了完全相同的问题,似乎是Android studio 3.1.3中的错误

我下载了Android studio 3.3 Canary 3,问题已为我解决。

https://developer.android.com/studio/preview/