我有一个导航抽屉,它实现了两个片段Header&页脚。我尝试将一些数据设置为onCreateView
函数中的Header Fragment,但在导航Drawer中加载后片段不会改变
HeaderFragement的onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_header_fragement, container, false);
name = (TextView) v.findViewById(R.id.nameH);
img = (ImageView) v.findViewById(R.id.imageViewHeader);
name.setText(infos.getString("Name"));
img.setImageBitmap(getBitmapFromURL(infos.getString("ImgUrl")));
return v;
}
这就是我在NavigationDrawer中实现它们的方法:
View header = inflater.inflate(R.layout.fragment_header_fragement, null);
View footer = inflater.inflate(R.layout.fragment_footer, null);
mDrawerListView.addHeaderView(header);
mDrawerListView.addFooterView(footer);
任何帮助,谢谢