小编Ali*_*eza的帖子

在Android 5(API 21)上设置ImageView colorFilter

我在Android 5(api 21)上使用ImageView遇到了奇怪的问题。当我在xml中设置ImageView色彩时,我无法在代码上更改它!!!我尝试了几种方法来以编程方式更改ImageView的colorFilter,但它不起作用。我仅在api 21上有此问题。

android imageview android-5.0-lollipop

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

API 21(android 5) 及以下版本上的正则表达式模式错误

Android 5 及更低版本在运行时从我的正则表达式模式中获取错误:

java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 4:
(?<g1>(http|ftp)(s)?://)?(?<g2>[\w-:@])+(?<TLD>\.[\w\-]+)+(:\d+)?((|\?)([\w\-._~:/?#\[\]@!$&'()*+,;=.%])*)*
Run Code Online (Sandbox Code Playgroud)

这是代码示例:

val urlRegex = "(?<g1>(http|ftp)(s)?://)?(?<g2>[\\w-:@])+(?<TLD>\\.[\\w\\-]+)+(:\\d+)?((|\\?)([\\w\\-._~:/?#\\[\\]@!$&'()*+,;=.%])*)*"
val sampleUrl = "https://www.google.com"
val urlMatchers = Pattern.compile(urlRegex).matcher(sampleUrl)
assert(urlMatchers.find())
Run Code Online (Sandbox Code Playgroud)

这种模式在 21 以上的所有 API 上都运行得非常好。

java regex android kotlin android-5.0-lollipop

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

标签 统计

android ×2

android-5.0-lollipop ×2

imageview ×1

java ×1

kotlin ×1

regex ×1