草庐IT

COLOR_BACKGROUND

全部标签

android - 如何设置paint.setColor(R.color.white)

我有一个自定义View,它使用Paint和Canvas来绘制对象。我的问题是如何设置:intcolor=R.color.white;paint.setColor(color);来self的/res/valuse/color.xml,其中包括类似的资源#FFFFFF#000000... 最佳答案 intcolor=ContextCompat.getColor(context,R.color.white);paint.setColor(color);setColor()方法将颜色编号作为int值,但不是作为int的资源id。

android - 如何设置paint.setColor(R.color.white)

我有一个自定义View,它使用Paint和Canvas来绘制对象。我的问题是如何设置:intcolor=R.color.white;paint.setColor(color);来self的/res/valuse/color.xml,其中包括类似的资源#FFFFFF#000000... 最佳答案 intcolor=ContextCompat.getColor(context,R.color.white);paint.setColor(color);setColor()方法将颜色编号作为int值,但不是作为int的资源id。

android - java.lang.UnsupportedOperationException : Can't convert value at index 5 to color: type=0x5

我的应用在更新到AndroidStudio3RC1(Gradle4,AndroidGradle插件3RC2)后崩溃。ThisistheerrorIamhaving:java.lang.RuntimeException:UnabletostartactivityComponentInfo{*****}:android.view.InflateException:BinaryXMLfileline#0:BinaryXMLfileline#0:Errorinflatingclasscom.viewpagerindicator.CirclePageIndicatoratandroid.app.

android - java.lang.UnsupportedOperationException : Can't convert value at index 5 to color: type=0x5

我的应用在更新到AndroidStudio3RC1(Gradle4,AndroidGradle插件3RC2)后崩溃。ThisistheerrorIamhaving:java.lang.RuntimeException:UnabletostartactivityComponentInfo{*****}:android.view.InflateException:BinaryXMLfileline#0:BinaryXMLfileline#0:Errorinflatingclasscom.viewpagerindicator.CirclePageIndicatoratandroid.app.

Android AppWidget TextView : How to set background color at run time

我正在尝试创建一个AppWidget,其中TextView的背景颜色以指定的周期间隔随机变化。TextView在布局xml文件中定义为在更新方法中,我已将布局加载为RemoteViewsremoteView=newRemoteViews(context.getPackageName(),R.layout.widget_message);要更改TextView的背景,我使用了以下语句remoteView.setInt(R.id.message,"setBackgroundResource",R.color.col_1);但我得到一个小部件,说加载小部件有问题。如果我删除上述行一切正常。L

Android AppWidget TextView : How to set background color at run time

我正在尝试创建一个AppWidget,其中TextView的背景颜色以指定的周期间隔随机变化。TextView在布局xml文件中定义为在更新方法中,我已将布局加载为RemoteViewsremoteView=newRemoteViews(context.getPackageName(),R.layout.widget_message);要更改TextView的背景,我使用了以下语句remoteView.setInt(R.id.message,"setBackgroundResource",R.color.col_1);但我得到一个小部件,说加载小部件有问题。如果我删除上述行一切正常。L

安卓牛轧糖 : TextureView doesn't support displaying a background drawable

我一直在我的Android应用程序中使用TextureView,它运行良好。就在最近,我在使用AndroidAPI25(7.1.2)的Android设备上测试了我的代码。相同的代码现在不起作用并引发错误,java.lang.UnsupportedOperationException:TextureView不支持显示背景可绘制对象。我知道voidsetBackgroundDrawable(可绘制背景)是deprecatedforalongtime,现在它必须已被删除。但我什至不是自己设置的。我正在使用最新的buildTools和SDK。所以,我想知道为什么没有更新textureView内

安卓牛轧糖 : TextureView doesn't support displaying a background drawable

我一直在我的Android应用程序中使用TextureView,它运行良好。就在最近,我在使用AndroidAPI25(7.1.2)的Android设备上测试了我的代码。相同的代码现在不起作用并引发错误,java.lang.UnsupportedOperationException:TextureView不支持显示背景可绘制对象。我知道voidsetBackgroundDrawable(可绘制背景)是deprecatedforalongtime,现在它必须已被删除。但我什至不是自己设置的。我正在使用最新的buildTools和SDK。所以,我想知道为什么没有更新textureView内

android - FirebaseCloudMessaging : FirebaseInstanceId background sync failed - SERVICE_NOT_AVAILABLE

我在Android中使用FirebaseCloudMessaging(FCM)API进行推送通知。当我实现那个时候完美的工作,但现在它找不到googleplay的服务。错误是:FirebaseInstanceId:backgroundsyncfailed:SERVICE_NOT_AVAILABLE,请帮我解决一下。我在gradle文件中使用了以下依赖项。dependencies{compilefiles('libs/ksoap2-android-assembly-3.4.0-jar.jar')compile'com.android.support:appcompat-v7:23.0.0

android - FirebaseCloudMessaging : FirebaseInstanceId background sync failed - SERVICE_NOT_AVAILABLE

我在Android中使用FirebaseCloudMessaging(FCM)API进行推送通知。当我实现那个时候完美的工作,但现在它找不到googleplay的服务。错误是:FirebaseInstanceId:backgroundsyncfailed:SERVICE_NOT_AVAILABLE,请帮我解决一下。我在gradle文件中使用了以下依赖项。dependencies{compilefiles('libs/ksoap2-android-assembly-3.4.0-jar.jar')compile'com.android.support:appcompat-v7:23.0.0