确切的错误:
07-16 18:34:41.729: ERROR/AndroidRuntime(28347): android.content.res.Resources$NotFoundException: Resource ID #0x7f030001
07-16 18:34:41.729: ERROR/AndroidRuntime(28347): at android.content.res.Resources.getValue(Resources.java:892)
07-16 18:34:41.729: ERROR/AndroidRuntime(28347): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
07-16 18:34:41.729: ERROR/AndroidRuntime(28347): at android.content.res.Resources.getLayout(Resources.java:731)
07-16 18:34:41.729: ERROR/AndroidRuntime(28347): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
...
电话:
LayoutInflater a = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
LinearLayout mainLayout = (LinearLayout)findViewById(R.id.linearLayout1);
mainLayout.removeAllViews();
mainLayout.addView(a.inflate(R.layout.input, null));
底线引发错误。
错误中的资源ID是
R.layout.input
,我正尝试将其插入另一个LayoutView mainLayout
。奇怪的是,它仅在我在手机上调试时发生,当我在模拟器中运行它时,它可以完美运行并根据需要添加LayoutView,但是如果我尝试在手机上进行调试,则会出现此错误。
最佳答案
尝试在Eclipse中使用Project> Clean清理项目。这似乎为我解决了大多数这些莫名其妙的问题。
关于java - 放大 View 会在物理设备上抛出Resources $ NotFoundException,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6719344/