草庐IT

wp_register_style

全部标签

android - "IntentReceiver components are not allowed to register to receive intents"尝试确定电池电量时

我正在尝试按照http://developer.android.com/training/monitoring-device-state/battery-monitoring.html中的指南从我的应用程序中获取电池信息。这是检查电池电量的方法:publicvoidsendBatteryInfoMessage(){IntentFilteriFilter=newIntentFilter(Intent.ACTION_BATTERY_CHANGED);IntentbatteryStatus=c.registerReceiver(null,iFilter);intstatus=batteryS

android - 让我们解决当前主题中的 "Failed to find style ' mapViewstyle'错误

很抱歉再发布一个,但似乎我们还没有记录此问题的所有解决方案。事情是这样的:我添加了一个mapView,一切正常。我添加了一个滑动抽屉并将按钮移动到其中,然后将根节点从线性更改为相对。从那时起,我的main.xml类的图形布局中出现错误,显示为Missingstyles.Isthecorrectthemechosenforthislayout?UsetheThemecomboboxabovethelayouttochooseadifferentlayout,orfixthethemestylereferences.Failedtofindstyle'mapViewStyle'incurr

android - 奇怪的 "Receiver not registered"异常

在onResume()中我会这样做:registerReceiver(timeTickReceiver,newIntentFilter(Intent.ACTION_TIME_TICK));在onPause()中:unregisterReceiver(timeTickReceiver);我在Android开发者控制台中看到“java.lang.IllegalArgumentException:Receivernotregistered”报告(只有2份报告,我的应用有数千名用户)。异常由unregisterReceiver()触发。会发生什么?只是用try-catch包围它,我觉得不是很有

升级到 gradle 5.0 后 Android 数据绑定(bind) "Missing import expression although it is registered"

在我将我的AndroidStudio升级到3.4后,AndroidGradlePlugin升级到3.4和gradle到5.1.1我收到如下数据绑定(bind)错误我已经确定我清理了项目并重建,我已经清除了缓存并重新启动了AS。升级前从未出现过此问题我可以确认这是因为新的gradle更新DataBinderMapperImpl.java:54:error:cannotfindsymbole:[kapt]Anexceptionoccurred:android.databinding.tool.util.LoggedErrorException:Founddatabindingerrors.

android - 获取 styled 属性中使用的可绘制引用的资源 id

拥有这个自定义ViewMyView我定义了一些自定义属性:并在布局XML中按如下方式分配它们:起初我以为我可以使用backgroundBase检索自定义属性:TypedArraya=context.getTheme().obtainStyledAttributes(attrs,R.styleable.MyView,defStyle,0);intbase=a.getInteger(R.styleable.MyView_backgroundBase,R.drawable.blank);只有在没有分配属性并且返回默认的R.drawable.blank时才有效。当app:backgroundB

android - 如何在 Android 中以编程方式创建 'Horizontal style' 进度条?

我正在以编程方式在我的应用程序中创建一个ProgressBar,默认情况下它是SPIN样式,但我希望它是HORIZONTAL样式。我没有看到任何方法/常量来实现这一点。而且我不想使用ProgressDialog,因为它与我的AppUI主题不一致。有什么建议吗? 最佳答案 使用这个:ProgressBarpb=newProgressBar(context,null,android.R.attr.progressBarStyleHorizontal); 关于android-如何在Androi

安卓服务 - 错误 : service not registered

我正在尝试了解有界服务。在我尝试遵循的示例程序下方http://developer.android.com/guide/components/bound-services.html.该服务可以播放、暂停和停止音频,但当我切换到另一个应用程序时,我收到以下服务未注册错误。java.lang.RuntimeException:Unabletostopactivity{com.example.dd_services_audio_01/com.example.dd_services_audio_01.MainActivity}:java.lang.IllegalArgumentExceptio

xml - 在 styles.xml 中设置特定字体

我正在为我的android应用程序定义样式XML。我有一些我想使用的TTF文件,如何设置字体以使用这些文件作为字体,而不是通用的“sans”、“serif”和“monospace”。谢谢 最佳答案 您只能通过Java代码使用自定义字体,而不是通过布局XML或样式/主题——抱歉! 关于xml-在styles.xml中设置特定字体,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/256

安卓工作室 : Error parsing XML & URI is not registered

在我的项目中添加一个新Activity后,我在编译布局时出现以下错误Gradle:ErrorparsingXML:notwell-formed(invalidtoken)"/>"http://schemas.android.com/apk/res/android"标记为红色,悬停会弹出以下消息URIisnotregistered(Setting|ProjectSettings|SchemasandDTDs)我的设置>项目设置>架构和DTD如下所示:我已经在这里发现了一些类似的问题,但没有任何帮助我解决这个问题。我希望有人有一个想法...:) 最佳答案

android - 无法解析 style.xml 中的符号 'Theme.AppCompat.Light.DarkActionBar'

Theme.AppCompat.Light.DarkActionBar未在styles.xml中编译。我在应用模块中添加了compile'com.android.support:appcompat-v7:25.1.0'build.gradle。我在谷歌搜索过解决方案。其中很多是关于更改Project的build.gradle中的类路径。仍然显示相同的错误。build.gradledependencies{compile'com.android.support:appcompat-v7:25.1.0'compile'com.android.support:design:25.1.0'co