首页 > 解决方案 > 每当在android studio中打开新项目时,可绘制的ic_launcher_background.xml文件中的错误

问题描述

在我之前的项目中没有这样的问题,ic_launcher_background.xml文件也不同。

<?xml version="1.0" encoding="utf-8"?>

<view xmlns:android="http://schemas.android.com/apk/res/android"
    style="?attr/snackbarStyle"
    class="com.google.android.material.snackbar.Snackbar$SnackbarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:theme="@style/ThemeOverlay.AppCompat.Dark" />

错误格式不正确

标签: javaandroidandroid-studioandroid-layout

解决方案


删除这个

  style="?attr/snackbarStyle"
    class="com.google.android.material.snackbar.Snackbar$SnackbarLayout"

代码将是这样的。

<?xml version="1.0" encoding="utf-8"?>

<view xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:theme="@style/ThemeOverlay.AppCompat.Dark" />

推荐阅读