我想在我的应用程序中使用这种强调(绿色?)颜色
但是该颜色是在某个地方定义的并且可以使用它还是需要在我的资源中定义它?
答案 0 :(得分:0)
请在您的values / styles.xml文件中添加以下样式
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="colorAccent">#80cbc4</item>
</style>
答案 1 :(得分:0)
否,它不是您的应用中预先定义的。
您必须在(?=(?:\d{3})+\b)
文件中明确定义颜色。
答案 2 :(得分:0)
转到res => values => colors
用colorAccent替换颜色
答案 3 :(得分:0)
这是Android OS的配色。您可以使用以下方法获取它:
package com.example.mypackage
object ApplicationRunner {
def main(args: Array[String]): Unit = {
println(mavenSourcesDirectory.toString)
}
}
使用此功能解析属性(科特林扩展名)
<>
所以您的代码如下所示:
Error:scalac: Error: assertion failed:
no extension method found for:
method /:(pathString: String)java.nio.file.Path
Candidates:
Candidates (signatures normalized):
"
while compiling: /home/me/example-repo/src/test/scala/com/example/mypackage/PathHelper.scala
during phase: globalPhase=erasure, enteringPhase=refchecks
library version: version 2.13.0
compiler version: version 2.13.0
reconstructed args: -classpath <.jar path for every dependency I use>
last tree to typer: Select(Apply(method to), foreach$mVc$sp)
tree position: <some line in an entirely different class where I don't use PathHelper>
tree tpe: (f: Int => Unit)Unit
symbol: (final override) method foreach$mVc$sp in class Range
symbol definition: final override def foreach$mVc$sp(f: Int => Unit): Unit (a MethodSymbol)
symbol package: scala.collection.immutable
symbol owners: method foreach$mVc$sp -> class Range
call site: object PathHelper in package mypackage in package mypackage
== Source file context for tree position ==
12 <line from file>
13 <line from file>
14 <tree position>
15 <line from file>
at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:170)
at scala.tools.nsc.transform.ExtensionMethods.$anonfun$extensionMethod$1(ExtensionMethods.scala:54)
at scala.tools.nsc.transform.ExtensionMethods.extensionMethod(ExtensionMethods.scala:49)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$4.preEraseNormalApply(Erasure.scala:1102)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$4.preEraseApply(Erasure.scala:1204)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$4.preErase(Erasure.scala:1214)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$4.transform(Erasure.scala:1333)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$4.transform(Erasure.scala:993)
at scala.reflect.internal.Trees$ValDef.$anonfun$transform$4(Trees.scala:405)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2625)
<and so on for 78 more lines of stack trace>