android:textColor 支持库 23.2.1 更新后无法使用
android:textColor not working after support library 23.2.1 update
我有一堆卡片视图,其中包含文本视图,如下所示:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/crdView"
android:clickable="true"
android:onClick="onClick"
card:cardUseCompatPadding="true"
card:cardElevation="@dimen/card_elevation"
card:cardCornerRadius="@dimen/card_corner"
card:cardBackgroundColor="@color/darkorange">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:drawableRight="@drawable/arrow_right"
android:drawableEnd="@drawable/arrow_right"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/abc_text_size_medium_material"
android:textColor="#FFFFFF"
android:text="@string/text" />
</android.support.v7.widget.CardView>
我已将 textColor 属性设置为白色,如您所见。但是当我 运行 任何版本的应用程序 android 不是 6.0 时,它对文本视图的文本颜色根本没有影响。
到目前为止我已经尝试过:
- 在 gradle
中更改我的 buildToolsVersion
- 在 gradle 中更改支持库本身的版本,回到
'com.android.support:appcompat-v7:23.0.1'
- 几次彻底清理和重建
- 尝试以编程方式设置它,这可行(但必须对 20 多个具有大量文本视图的活动执行此操作根本不可行)
有什么我做的不对吗?我现在应该设置不同的属性吗?
编辑:如果有帮助,这是我的 build.gradle:
apply plugin: 'com.android.application'
android {
defaultConfig {
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
signingConfigs {
signingconfig {
// sanitized
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "in.myapp"
minSdkVersion 10
targetSdkVersion 23
versionCode 16
versionName "1.1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
zipAlignEnabled true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
// other libraries
}
请在这里找到我的答案
显然问题出在 Mavel Local Repository。将其降级到版本 26 即可。
我有一堆卡片视图,其中包含文本视图,如下所示:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/crdView"
android:clickable="true"
android:onClick="onClick"
card:cardUseCompatPadding="true"
card:cardElevation="@dimen/card_elevation"
card:cardCornerRadius="@dimen/card_corner"
card:cardBackgroundColor="@color/darkorange">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:drawableRight="@drawable/arrow_right"
android:drawableEnd="@drawable/arrow_right"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/abc_text_size_medium_material"
android:textColor="#FFFFFF"
android:text="@string/text" />
</android.support.v7.widget.CardView>
我已将 textColor 属性设置为白色,如您所见。但是当我 运行 任何版本的应用程序 android 不是 6.0 时,它对文本视图的文本颜色根本没有影响。
到目前为止我已经尝试过:
- 在 gradle 中更改我的
- 在 gradle 中更改支持库本身的版本,回到
'com.android.support:appcompat-v7:23.0.1'
- 几次彻底清理和重建
- 尝试以编程方式设置它,这可行(但必须对 20 多个具有大量文本视图的活动执行此操作根本不可行)
buildToolsVersion
有什么我做的不对吗?我现在应该设置不同的属性吗?
编辑:如果有帮助,这是我的 build.gradle:
apply plugin: 'com.android.application'
android {
defaultConfig {
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
signingConfigs {
signingconfig {
// sanitized
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "in.myapp"
minSdkVersion 10
targetSdkVersion 23
versionCode 16
versionName "1.1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
zipAlignEnabled true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
// other libraries
}
请在这里找到我的答案
显然问题出在 Mavel Local Repository。将其降级到版本 26 即可。