在 fragment 里面调用 findViewById
来源:互联网 发布:百度指数 数据导出 编辑:程序博客网 时间:2024/05/18 02:17
在 fragment 里面调用 findViewById
public class CompanyListFragment extends Fragment {
private Activity activity;
private ListView companyListView;
@Override
public View onCreateView(LayoutInflater infalter, ViewGroup container, Bundle savedInstanceState) {
View view = infalter.inflate(R.layout.companylist_for_sport, container, false);
companyListView = (ListView)view.findViewById(R.id.companyListView);
return view;
}
}
注意1: 是在 onCreateView 中
注意2: 是 view.findViewById 而不是 activity.findViewById
0 0
- 在 fragment 里面调用 findViewById
- 在 fragment 里面调用 findViewById
- 在 fragment 里面调用 findViewById
- 如何在Fragment中使用findViewById呢?
- 如何在Fragment中使用findViewById
- 在fragment里面嵌套fragment
- Android在Adapter里面调用Activity或者fragment里面的的方法/变量代码
- Android在循环中调用findViewById();
- Fragment中的findviewbyid
- 在fragment里面获取及添加actionbar
- 在Fragment里面实现listView布局
- 在fragment里面的splash界面
- fragment在activity里面实例化
- 在activity里面实现fragment管理
- 在Fragment中加载布局后使用findViewById出现空指针错误
- 在fragment中调用SharedPreferences
- 关于fragment里面调用startActivityForResult,onActivityResult没有反应的学习
- Fragment里面嵌套Fragment
- TCP/IP协议学习之五(UDP协议)
- iOS播放音乐文件时的操作和打断处理
- twisted05 简单的http服务器
- deepin 切换输入法
- 使用cout输出小数时位数的控制方法
- 在 fragment 里面调用 findViewById
- PHP学习总结(二)
- 22-IO流-26-IO流(转换流-需求演示)
- Chromium多进程架构初探-兼谈Android平台版本
- 问题:CentOS 7.0部署Docker报错
- Android 3.0 API变更概要
- 先成为锦,然后才能添花
- 最好用的屏幕录像软件BB FlashBack v5.8.0 Pro
- 为Android Studio设置HTTP代理