ViewPager的Fragment中嵌套的Fragment怎么实现刷新数据
1个回答
2016-08-02
展开全部
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.bottom_fragment_one, container, false);
tmpD= (TextView) view.findViewById(R.id.tmp_d);
tmpN = (TextView) view.findViewById(R.id.tmp_n);
imageD= (SimpleDraweeView) view.findViewById(R.id.image_d);
imageN= (SimpleDraweeView) view.findViewById(R.id.image_n);
setUI();
return view;
}
//用来设置UI,更新UI时重新从数据库获取数据,进行设置
public void setUI(){
Forecast forecast = mFrecastDao.getForecastByCity(mCity);
tmpD.setText(forecast.getDaily_1_max());
tmpN.setText(forecast.getDaily_1_min());
imageD.setImageURI(getImageUri(forecast.getDaily_1_code_d()));
imageN.setImageURI(getImageUri(forecast.getDaily_1_code_n()));
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.bottom_fragment_one, container, false);
tmpD= (TextView) view.findViewById(R.id.tmp_d);
tmpN = (TextView) view.findViewById(R.id.tmp_n);
imageD= (SimpleDraweeView) view.findViewById(R.id.image_d);
imageN= (SimpleDraweeView) view.findViewById(R.id.image_n);
setUI();
return view;
}
//用来设置UI,更新UI时重新从数据库获取数据,进行设置
public void setUI(){
Forecast forecast = mFrecastDao.getForecastByCity(mCity);
tmpD.setText(forecast.getDaily_1_max());
tmpN.setText(forecast.getDaily_1_min());
imageD.setImageURI(getImageUri(forecast.getDaily_1_code_d()));
imageN.setImageURI(getImageUri(forecast.getDaily_1_code_n()));
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询