相关疑难解决方法(0)

setContentView上的另一个资源$ NotFoundException

Stack Overflow上有很多资源$ NotFoundException问题,我已经审阅了它们,并尝试了各种建议无济于事.

我有一个完美的工作布局,显示一些图形与下面的一些按钮,我修改了一些按钮,并开始得到这个错误.我没有看到我的更改有什么问题,但只是为了缩小它我删除了所有按钮,所以现在我只有一个带有ImageView的LinearLayout,我仍然得到错误.我的Java:

    try  {
        setContentView(R.layout.graphics);
    }
    catch (Exception e)  {
        Log.d("DGraphActivity", "setContentView crash");   
    }
Run Code Online (Sandbox Code Playgroud)

我的XML:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
   <ImageView 
      android:id="@+id/image2"
      android:layout_width="0px"
      android:layout_weight="2"
      android:layout_height="match_parent"
      android:scaleType="fitCenter">
    </ImageView>
 </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

错误说android.content.res.Resources $ NotFoundException:资源ID#0x7f030005.在R.java文件中,资源用图形标识...

public static final class layout {
        public static final int addcomment=0x7f030000;
        public static final int areyousure=0x7f030001;
        public static final int downarrow=0x7f030002;
        public static final int downleftarrow=0x7f030003;
        public static final int downrightarrow=0x7f030004;
        public static final int graphics=0x7f030005;
        public static …
Run Code Online (Sandbox Code Playgroud)

java xml resources android

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

标签 统计

android ×1

java ×1

resources ×1

xml ×1