小编Abe*_*gan的帖子

错误:已定义属性"颜色",更新appcompat v-7

我正在尝试将Android Studio项目中的appcompat-v7从v20.0.0更新为21.0.0以使用材料设计组件,但我总是得到同样的错误:

"错误:属性"颜色"已经定义"

我不知道如何解决此错误,我在网上搜索但我无法得到答案.这是我的傻瓜:

android {

    compileOptions.encoding = "iso-8859-1"
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.test"
        minSdkVersion 11
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])
 compile 'com.android.support:support-v4:20.0.0'
    compile 'com.google.http-client:google-http-client-gson:1.19.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile "com.android.support:appcompat-v7:21.0.+"

}
Run Code Online (Sandbox Code Playgroud)

这是冲突存在的路径

C:\Users\Abel Dominguez\Documents\PROYECTOS_ANDROID\definitivos\d2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\values\values.xml
Run Code Online (Sandbox Code Playgroud)

这是另一个错误:

Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\Abel Dominguez\AppData\Local\Android\sdk1\build-tools\build-tools-21.1.1\aapt.exe package -f --no-crunch -I C:\Users\Abel Dominguez\AppData\Local\Android\sdk1\platforms\android-21\android.jar -M C:\Users\Abel Dominguez\Documents\PROYECTOS_ANDROID\definitivos\d2\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\Abel Dominguez\Documents\PROYECTOS_ANDROID\definitivos\d2\app\build\intermediates\res\debug -A …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat

8
推荐指数
1
解决办法
1万
查看次数

从我的CollapsingToolbarLayout更改颜色

我正在尝试根据Material Design规则制作CollapsingToolbar动画。一切正常,但一件事情令我沮丧。滚动回收器视图时,我试图更改“折叠的”工具栏的颜色,但是获得的透明颜色始终是相同的...

这是我的xml代码:

<android.support.design.widget.AppBarLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="256dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            android:fitsSystemWindows="true"
            android:background="@color/gps_friends_green_main"
            app:contentScrim="@color/gps_friends_green_main"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp">
            <ImageView
                android:id="@+id/imgHeader"
                app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolBarDetalleContacto"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:theme="@style/MyNavigationDrawerTheme"
                app:layout_collapseMode="pin">
                </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>
 </android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的Java代码

int mutedColor = R.color.gps_friends_green_main;

    Palette.generateAsync(bitmap,
                    new Palette.PaletteAsyncListener() {
                        @Override
                        public void onGenerated(Palette palette) {
                            Palette.Swatch vibrant =
                                    palette.getVibrantSwatch();

                            if (vibrant != null) {
                                // If we have a vibrant color
                                // update the title TextView
                                collapseToolbar.setBackgroundColor(mutedColor);
                                //  mutedColor …
Run Code Online (Sandbox Code Playgroud)

java android colors

1
推荐指数
1
解决办法
5894
查看次数

标签 统计

android ×2

android-appcompat ×1

colors ×1

java ×1