2

我刚刚升级到 Android Studio 2.3,但是当我尝试显示这个布局时:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_margin="@dimen/card_margin"
        android:elevation="3dp"
        app:cardBackgroundColor="@color/transparent"
        android:background="@color/transparent"

        app:cardCornerRadius="@dimen/card_album_radius">

        <RelativeLayout
            android:id="@+id/main_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/thumbnail"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_centerInParent="true"
                android:clickable="true"
                android:scaleType="fitCenter" />


            <ImageView
                android:id="@+id/alarm"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/toolbar_alarm"
                android:alpha="0.35"
                android:layout_alignParentStart="true"
                android:layout_alignParentBottom="true"
                android:paddingBottom="@dimen/songs_count_padding_bottom"
                android:paddingLeft="@dimen/album_title_padding"
                />

            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingBottom="@dimen/songs_count_padding_bottom"
                android:paddingLeft="@dimen/album_title_padding"
                android:paddingRight="@dimen/album_title_padding"
                android:layout_toRightOf="@id/alarm"
                android:layout_alignParentBottom="true"
                android:textSize="@dimen/songs_count"
                tools:text="Sample Title" />

            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="16sp"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:textColor="@color/album_title"
                android:textSize="@dimen/note_card_title"
                android:textStyle="normal"

                />


            <ImageView
                android:id="@+id/overflow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentBottom="true"
                android:scaleType="centerCrop"
                android:src="@drawable/ic_dots" />

        </RelativeLayout>

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

</LinearLayout>

我从界面设计器(布局编辑器)收到此错误:

The following classes could not be found:
- android.support.v7.app.WindowDecorActionBar (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ActionBarContainer (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ActionBarContextView (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Create Class)
- android.support.v7.widget.ContentFrameLayout (Fix Build Path, Edit XML, Create Class)

点击Fix Build Path或其他链接无效。

4

2 回答 2

0

这解决了我的问题:

将您的样式父更改为Theme.AppCompat.Light.NoActionBar而不是Theme.AppCompat.Light.DarkActionBar在 styles.xml 中............它对我有用。

https://stackoverflow.com/a/40067731/305135

于 2017-03-06T06:12:02.867 回答
0

尝试检查您的依赖项。更新到 Android Studio 2.3 后,我的 gradle 坏了。

查看详细信息

于 2017-03-08T20:29:04.790 回答