mic*_*ael 16 android android-layout android-xml android-theme android-studio
我想创建卡项xml布局CardView并获取此错误.这里的常见解决方案没有奏效(尝试过所有这些以及其他类似帖子).
这是我的xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="3dp"
card_view:cardElevation="4dp">
</android.support.v7.widget.CardView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是以下相关部分styles.xml:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/primary_accent</item>
</style>
<!--Theme for Tool Bar (Action Bar)-->
<style name="ToolBarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">@color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这是以下相关部分Manifest:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud)
这是gradle build脚本的相关部分:
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
Run Code Online (Sandbox Code Playgroud)
这是错误:
谢谢,
Har*_*GUL 11
您可以通过将当前主题更改为合适的主题来解决此问题.每个主题都不适合所有类型的视图.通过使用主题组合框,我们可以解决这个问题.
这是问题所在
1.首先去主题栏并按下它

2.如下图所示更改主题
现在你改变了你的主题.如果选定的主题适合您的视图,它将呈现.
| 归档时间: |
|
| 查看次数: |
45468 次 |
| 最近记录: |