标签:public 图片 bundle rgb oncreate onpause img reg ide
1.学习了这么多知识开始实战
部分代码:public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//这个修改为对应子Fragment和父Fragment的布局文件
View view = inflater.inflate(R.layout.fragment_my,container, false);
register = (Button) view.findViewById(R.id.main_register_button1);
login = (Button) view.findViewById(R.id.login_button1);
register.setOnClickListener(this);
login.setOnClickListener(this);
return view;
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.main_register_button1:
Intent intent = new Intent();
intent.setClass(v.getContext(), RegisterActivity.class);//this前面为当前activty名称,class前面为要跳转到得activity名称
startActivity(intent);
break;
case R.id.login_button1:
Intent intent2 = new Intent();
intent2.setClass(v.getContext(), LoginActivity.class);//this前面为当前activty名称,class前面为要跳转到得activity名称
startActivity(intent2);
break;
}
标签:public 图片 bundle rgb oncreate onpause img reg ide
原文地址:https://www.cnblogs.com/chenghaixiang/p/14914656.html