Drawable Ripple Effect 颜色错误
Drawable RippleEffectColor Errorl
"@color/rippleEffectColor" Error in Red
应用程序>资源>值>Colors.xml
- 我已经为 RippleEffectColor
创建了颜色
<resources>
<Color name="rippleEffectColor">#F816A463</Color>
</resources>
App>Res>Drawable
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
**android:color="@color/rippleEffectColor"**
tools:targetApi="lollipop"
>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/btnSignIn"></solid>
<stroke android:color="color/btnSignIn" android:width="2dp"></stroke>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>
但我一直在 android:color="@color/rippleEffectColor"
您的代码中有两个拼写错误。
我 运行 它是这样的,它正在工作:
<resources>
// color has to be lower case
<color name="rippleEffectColor">#F816A463</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="@color/rippleEffectColor"
tools:targetApi="lollipop"
>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/btnSignIn"></solid>
//The @ sign was missing before color
<stroke android:color="@color/btnSignIn" android:width="2dp"></stroke>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>
"@color/rippleEffectColor" Error in Red
应用程序>资源>值>Colors.xml - 我已经为 RippleEffectColor
创建了颜色<resources>
<Color name="rippleEffectColor">#F816A463</Color>
</resources>
App>Res>Drawable
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
**android:color="@color/rippleEffectColor"**
tools:targetApi="lollipop"
>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/btnSignIn"></solid>
<stroke android:color="color/btnSignIn" android:width="2dp"></stroke>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>
但我一直在 android:color="@color/rippleEffectColor"
您的代码中有两个拼写错误。 我 运行 它是这样的,它正在工作:
<resources>
// color has to be lower case
<color name="rippleEffectColor">#F816A463</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="@color/rippleEffectColor"
tools:targetApi="lollipop"
>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/btnSignIn"></solid>
//The @ sign was missing before color
<stroke android:color="@color/btnSignIn" android:width="2dp"></stroke>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>