更新:已解决,我是白痴,谢谢大家!
Okay little bit weird.. I just created a layout file for list items, I can see it there now, in my res/layout folder. It's called itemListBudget.xml. Inside i've declare two id's, catItem and budgetAmount as you can see here: http://pastebin.com/ZV0wr9L0 (it'll only take a second to look at)
So now i'm just trying to bind data from my sqlite table to my list! Here's my method:
//
private static int[] TO = { R.id.catItem, R.id.budgetAmount, };
private void showBudgetOutcome(Cursor cursor) {
//Set up data binding
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
this, R.layout.itemListBudget, cursor, FROM, TO,);
setListAdapter(adapter);
}
Now i'm being told that R.id.catItem cannot be resolved. R.id.budgetAmount cannot be resolved and of course R.layout.itemListBudget cannot be resolved. Why on earth could this be?
I also have an error message saying my setListAdapter(adapter) is undefined, but i think that's caused by the problem above right?
最佳答案
如果在 Eclipse 中尝试对项目进行清理并强制其重建 R.java
您的布局文件名中不能有大写字母!!! 它的 [a-z0-9_.]
关于android - 神秘!我的一个 .xml 布局资源未被检测到!这是怎么回事?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4319263/