- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我在诺基亚 7 plus、Android 8.1 版上启动应用程序时,应用程序运行良好,但当我在另一部 Android 6.0 版手机上尝试时,应用程序运行正常。我收到此错误:
E/UncaughtException: android.content.res.Resources$NotFoundException: Resource ID #0x7f0800a8
at android.content.res.Resources.getValue(Resources.java:1544)
at android.content.res.Resources.getDrawable(Resources.java:918)
at android.content.res.Resources.getDrawable(Resources.java:879)
at com.ephoenixdev.svecanitrenutak.lists.CategoryAdapter.getView(CategoryAdapter.java:102)
at android.widget.AbsListView.obtainView(AbsListView.java:2474)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1301)
at android.widget.ListView.onMeasure(ListView.java:1203)
at android.view.View.measure(View.java:19147)
at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1212)
at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1552)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
at android.view.View.measure(View.java:19147)
at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1119)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:3343)
at android.view.View.measure(View.java:19147)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2481)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1440)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1694)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1321)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6708)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
at android.view.Choreographer.doCallbacks(Choreographer.java:696)
at android.view.Choreographer.doFrame(Choreographer.java:631)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
09-11 13:26:20.614 24986-24986/com.ephoenixdev.svecanitrenutak E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ephoenixdev.svecanitrenutak, PID: 24986
android.content.res.Resources$NotFoundException: Resource ID #0x7f0800a8
at android.content.res.Resources.getValue(Resources.java:1544)
at android.content.res.Resources.getDrawable(Resources.java:918)
at android.content.res.Resources.getDrawable(Resources.java:879)
at com.ephoenixdev.svecanitrenutak.lists.CategoryAdapter.getView(CategoryAdapter.java:102)
at android.widget.AbsListView.obtainView(AbsListView.java:2474)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1301)
at android.widget.ListView.onMeasure(ListView.java:1203)
at android.view.View.measure(View.java:19147)
at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1212)
at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1552)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
at android.view.View.measure(View.java:19147)
at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1119)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:788)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:648)
at android.view.View.measure(View.java:19147)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6113)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:223)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:3343)
at android.view.View.measure(View.java:19147)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2481)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1440)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1694)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1321)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6708)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
at android.view.Choreographer.doCallbacks(Choreographer.java:696)
at android.view.Choreographer.doFrame(Choreographer.java:631)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
这就是我的代码的样子(RecycleView 适配器):
public class CategoryAdapter extends BaseAdapter {
private Activity context;
public CategoryAdapter(Activity context) {
this.context = context;
}
int[] kategorije = {
R.string.K_1,
R.string.K_2,
R.string.K_3,
R.string.K_4,
R.string.K_5,
R.string.K_6,
R.string.K_7,
R.string.K_8,
R.string.K_9,
R.string.K_10,
R.string.K_11,
R.string.K_12,
R.string.K_13,
R.string.K_14,
R.string.K_15,
R.string.K_16,
R.string.K_17,
R.string.K_18,
R.string.K_19,
R.string.K_20,
R.string.K_21,
R.string.K_22,
R.string.K_23,
R.string.K_24
};
int[] ikoniceKategorija = {
R.drawable.ic_muzika,
R.drawable.ic_restorani,
R.drawable.ic_dekoracije,
R.drawable.ic_foto,
R.drawable.ic_lepota,
R.drawable.ic_burme,
R.drawable.ic_torte,
R.drawable.ic_ketering,
R.drawable.ic_pica,
R.drawable.ic_vencanice,
R.drawable.ic_svecana_odela,
R.drawable.ic_aksesoar,
R.drawable.ic_obuca,
R.drawable.ic_pozivnice,
R.drawable.ic_satori,
R.drawable.ic_limuzine,
R.drawable.ic_prenociste,
R.drawable.ic_casoviplesa,
R.drawable.ic_igraonice,
R.drawable.ic_animacije,
R.drawable.ic_osoblje,
R.drawable.ic_pokloncici,
R.drawable.ic_organizatori,
R.drawable.ic_ostalo,
};
@Override
public int getCount() {
return kategorije.length;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
convertView = inflater.inflate(R.layout.list_item_categories,null);
ImageView imageView = convertView.findViewById(R.id.imageViewListItemCategories);
TextView textView = convertView.findViewById(R.id.textViewListItemCategories);
imageView.setImageResource(ikoniceKategorija[position]);
textView.setText(kategorije[position]);
return convertView;
}
}
这很奇怪:
知道哪里出了问题吗?我还尝试了其他一些手机,有些可以工作,有些则不行。
我将此称为 onCreate() 方法:
private void createList() {
// Kreiranje liste
ListView listView= findViewById(R.id.listViewMain);
CategoryAdapter categoryAdapter = new CategoryAdapter(CategoriesActivity.this);
listView.setAdapter(categoryAdapter);
}
最佳答案
确保所有图像都位于 Drawbles 文件夹内。然后
setImageDrawable 应该是这样的
Resources resources = context.getResources();
image.setImageDrawable(resources.getDrawable(ikoniceKategorija[position]));
关于java - E/UncaughtException : android. content.res.Resources$NotFoundException:资源 ID #0x7f0800a8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52275274/
我正在寻找外行人对计算机硬件和组织的介绍。以下是我想讨论的一些主题。 Brief intro to electronics. Gates and state machines, intro to re
有没有人在 Visual Basic 2010 中看到过这个错误,如果有的话......关于如何解决它的任何想法? 错误是 module 'Resources' and module 'Resourc
这个问题在这里已经有了答案: Why ?attr/colorAccent dose not work below lollipop version? (2 个答案) 关闭 5 年前。 我收到以下错误
我正在尝试通过 ring 学习 clojure 网络开发和 compojure我有点不清楚 compojure.route/resources 和 ring.middleware.resource/w
是否必须放置内部 try-with-resources 或其中一个 try-with-resources 中的所有内容都会自动关闭? try (BasicDataSource ds = Bas
我有一本包含多个食谱的 Chef 食谱,用于安装服务。 Chef-client 的工作方式是每 15 分钟(或其他固定时间间隔)重新收敛一次。现在我的食谱的第一步是停止服务,所以服务将每 15 分钟停
我有资源组“MyResources”,其中包含 4 个资源: AppService - 我的服务器, AppServicePlan - MyServerWestEuFarm, ApplicationI
我有资源组“MyResources”,其中包含 4 个资源: AppService - 我的服务器, AppServicePlan - MyServerWestEuFarm, ApplicationI
我有一个返回 ResponseEntity 的休息终点. 需要检查如何在 Swagger 规范中创建这种类型的响应。这里包中的资源是 org.springframework.core.io.Resou
In my azure portal I have 6 separate applications, I have to list all of the employed resources u
In my azure portal I have 6 separate applications, I have to list all of the employed resources u
我有一个问题,设计师不会显示表单。它失败,错误 Designer 给出警告,如下所示: 我该如何解决这个问题? 最佳答案 您似乎缺少在应用程序中加载此表单所需的项目 资源 . 您可以访问 资源右键单击
我是 angularJS 世界的新手,我可能误解了一些东西。 我的应用程序使用 Controller 、指令和服务,所有这些都运行完美,直到我使用带有 $resource 的服务,然后出现“冲突”或其
我在 Unity3D 工作。 我使用 Resources.LoadAll(path);加载文件夹和子文件夹中的所有项目。执行此操作后,我想获取对象的子文件夹名称或完整路径。这可能吗? 并且不建议使用
我需要监控每个客户端环境(一个订阅、多个资源组)的 Azure 支出。在我的研究中,我发现了 2 个可以使用的 API: 资源费率卡( https://msdn.microsoft.com/fr-fr
在 RDF 1.1 XML 语法文档中 rdf:resource 在定义 Empty Property Elements 时用作缩写形式: When a predicate arc in an RDF
这是一种常见的情况,我们需要在用户更新/创建一些数据后向用户显示错误/成功消息,我们如何在 AngularJS 中实现它? 我想添加回调但找不到解决方案。使用 $http.post().success
我正在使用 android studio 作为 IDE 开发一个 android 应用程序。 我的问题是: 如何在构建APK过程中排除某个目录下的某些文件? 在我的例子中,我想从构建中排除一些图像,因
在编译我的 Visual Studio C# 项目时,出现以下错误: 在“Resources”参数中多次指定项目“obj\Debug\SampleProject.Forms.MDIMain.resou
使用 CoffeeScript、Angular 和 $resource,我创建了以下工厂: angular.module('myapp', ['ngResource']).factory 'MyObj
我是一名优秀的程序员,十分优秀!