переход на материальный дизайн

Я пытаюсь перенести свое приложение для Android на материальный дизайн. Я следую этому руководству. . Однако, когда я пытаюсь создать или запустить приложение, я получаю следующие ошибки

/home/shimba/kaa/kAA/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.2/res/values-v11/values.xml
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
/home/shimba/kaa/kAA/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.2/res/values-v14/values.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
/home/shimba/kaa/kAA/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.2/res/values-v21/values.xml
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Dialog'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.

Где я ошибаюсь? Я использую Android-студию. У меня есть следующие зависимости в моем файле gradle

dependencies {
//compile project(':universalImageLoaderLibrary3')
compile 'com.android.support:support-v4:20.+'
//compile 'com.android.support:appcompat-v7:20.+'
compile project(':universalImageLoaderLibrary3')
compile 'com.android.support:appcompat-v7:21.0.+'
}

Пожалуйста помоги.


person mungaih pk    schedule 15.12.2014    source источник
comment
Для какой версии Android вы пытаетесь разработать? И можете ли вы указать свой файл стиля?   -  person Viral Thakker    schedule 15.12.2014
comment
возможный дубликат appcompat -v7:21.0.0': Ресурс с указанным именем не найден: attr 'android:actionModeShareDrawable'   -  person reVerse    schedule 16.12.2014


Ответы (3)


Обновите свою Android-студию. и Проверьте ошибки в файле values.xml.

Ошибка: (50, 21) Ресурс, соответствующий заданному имени, не найден: attr 'android: actionModeShareDrawable'. Ошибка: (50, 21) Ресурс, соответствующий заданному имени, не найден: attr 'android: actionModeShareDrawable'. Ошибка: (50, 21) Ресурс, соответствующий заданному имени, не найден: attr 'android: actionModeShareDrawable'. Ошибка: (50, 21) Ресурс, соответствующий заданному имени, не найден: attr 'android: actionModeShareDrawable'. Это атрибуты, которые отсутствуют в вашем xml.

Проверьте также идентификаторы, которые вы дали.

person Syed Tahir    schedule 15.12.2014

Используйте этот стиль в папке style.xml вместо использования материала, если ваше устройство ниже версии 5.0.

<style name="AppTheme" parent="Theme.AppCompat.Light">     
    <item name="colorPrimary">@color/blue</item>
    <item name="colorAccent">@color/lite_blue</item>
    <item name="colorPrimaryDark">@color/dark_blue</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:windowBackground">@color/lite_blue</item>
</style>

r Если вы используете устройство с версией 5.0, используйте этот

 <style name="AppTheme" parent="android:Theme.Material.Light">
    <item name="android:windowActionBar">false</item>
    <item name="android:colorPrimary">@color/blue</item>
    <item name="android:colorAccent">@color/lite_blue</item>
    <item name="android:colorPrimaryDark">@color/dark_blue</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:windowBackground">@color/lite_blue</item>
</style>
person Viral Thakker    schedule 15.12.2014

Вот вам комплексный ответ

Material Design от Android 2.2 (API 8) до настоящей версии 5.0 (API 21)

Вот что вам нужно:

  1. Панель инструментов
  2. Библиотека дизайна материалов для виджетов (кнопки, флажки и т. д.)

<сильный>1. Панель инструментов

Просто получите идею, и вы готовы к работе.

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimaryDark"/>

Руководство по установке: http://antonioleiva.com/material-design-everywhere/

Источник с примером: https://github.com/antoniolg/MaterialEverywhere

Чтобы Панель инструментов работала ниже API 11, используйте Theme.AppCompat.Light.NoActionBar (вместо этого для windowActionBar задано значение false)

<style name="NoActionBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
     ...
</style>

<сильный>2. Библиотека дизайна материалов

Вот Библиотека дизайна материалов для красивых кнопок и т. д. В настоящее время она сильно развита.

Руководство, код, пример — https://github.com/navasmdc/MaterialDesignLibrary

Руководство по добавлению библиотеки в Android Studio 1.0Как импортировать библиотеку дизайна материалов в Android Studio?

.

Я ответил на ваш вопрос?)

person Inoy    schedule 15.01.2015