3
我試圖將我的片段從經典實現切換到AndroidAnnotations。 當我使用@EFragment(R.layout.my_fragment)時,我得到一個空白的視圖。使用AndroidAnnotations在片段中注入視圖
@EFragment(R.layout.my_fragment)
public class MyFragment extends Fragment {
}
如果我再這樣下去它的確定:
public class MyFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.my_fragment, container, false);
return view;
}
}
我缺少什麼?文檔說加下劃線時,我實例化的片段,如:
MyFragment fragment = new MyFragment_();
代替:
MyFragment fragment = new MyFragment();
但如我所料,這是隻給一個編譯錯誤。
您是否檢查過文件「MyFragment_」已生成? –