Activity中获取当前Fragment 中的子控件
XXXAdapter中 增加
public Fragment currentFragment;
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
//获取当前fragment
currentFragment = (Fragment)object;
super.setPrimaryItem(container, position, object);
}
Activity中保存之前设置的Adapter,获取子viiew
private XXXAdapter xxxAdapter;
EditText etName = (EditText)xxxAdapter.currentFragment.getView().findViewById(R.id.et_name);
posted on 2016-12-31 11:12 robert_hly 阅读(1127) 评论(0) 编辑 收藏 举报