简体   繁体   English

Android Studio资源文件丢失

[英]Android Studio resource file missing

I want to create a listview with a simple list item in android studio, and as we all know we write android.R.simple_list_item_1 . 我想在android studio中创建一个带有简单列表项的listview ,众所周知,我们编写了android.R.simple_list_item_1

However, my problem is that when I type android. 但是,我的问题是当我键入android. , I don't get in the suggestions the "R", I tried typing completing it manually and typing android.R. ,我没有收到建议中的“ R”,而是尝试手动输入并填写完成并输入android.R. , but I don't get suggestions for list items and I get an error. ,但没有得到有关列表项的建议,并且出现错误。

I checked my android sdk and java sdk paths and they're correct. 我检查了我的android sdk和java sdk路径,它们是正确的。

Why is the android resource file missing from the suggestions?? 为什么建议中缺少android资源文件?

它是

android.R.layout.simple_list_item_1

First make sure your class imports YOUR.PACKAGE.NAME.android.R 首先,请确保您的课程导入了YOUR.PACKAGE.NAME.android.R

Second you need a first build inorder to have android.R file. 其次,您需要首先构建才能拥有android.R文件。 Check if you have this file and if you haven't build your project. 检查是否有此文件,以及是否尚未构建项目。 I believe building is called Sync Gradle in android studio. 我相信在android studio中该建筑称为Sync Gradle。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM