我通過訪問其服務中的applicationInfo並通過packageManager獲取資源,從而訪問了另一個APK的佈局。如果在佈局中只指定了textView和Buttons,那麼它工作正常。但如果在訪問的佈局中使用任何可繪製資源,則拋出Resource not found Exception
。從另一個APK訪問的佈局無法訪問其可繪製資源
這是我的代碼來訪問佈局
ApplicationInfo info = packageManager.getApplicationInfo(packageName, 0);
Resources res = packageManager.getResourcesForApplication(info);
XmlResourceParser xres = res.getLayout(0x7f030000);
我甚至嘗試刪除gen和bin文件夾來重新創建它,但它從來沒有工作。但如果我複製所有可訪問到我的項目的佈局的apk中使用的可繪製資源的作品。但我不想這樣做。有人可以幫助 – jaagstorm 2013-04-25 10:19:23