我遇到此错误,并且我尝试清理和重建,但没有成功。我试图使缓存无效并重新启动,但是它没有用。有什么帮助吗?
HomeFragment.Java
package name.com.project.Home;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.R;
/**
* Created by User on 5/28/2017.
*/
public class HomeFragment extends Fragment {
private static final String TAG = "HomeFragment";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
return view;
}
}
fragment_home.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView" />
</RelativeLayout>
我的xml文件没有出现错误。请帮忙。
编辑!!!
删除此内容
import android.R;
我现在收到此错误
cannot resolve symbol 'R'
答案 0 :(得分:0)
尝试删除
import android.R;
并添加
import name.com.project.Home.R;