android 改变系统字体 界面切换问题

主界面使用FragmentManager,FragmentTransaction和底部RadioGroup来控制界面切换,在app后台运行状态下,改变系统字体,这时再点击... 主界面使用FragmentManager,FragmentTransaction和底部RadioGroup来控制界面切换,在app后台运行状态下,改变系统字体,这时再点击底部按钮,fragment不切换,这是为啥,怎么处理?
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
fragmentTransaction = fragmentManager.beginTransaction();
switch (checkedId){
case R.id.btn_share_main:
hideFragment(fragmentTransaction);
if (shareFragment != null) {
fragmentTransaction.show(shareFragment);
}else{
shareFragment = new ShareFragment();
fragmentTransaction.add(R.id.main_container, shareFragment);
}
break;
case R.id.btn_school_main:
hideFragment(fragmentTransaction);
if (schoolFragment != null) {
fragmentTransaction.show(schoolFragment);
}else{
schoolFragment = new SchoolFragment();
fragmentTransaction.add(R.id.main_container, schoolFragment);
}
break;
case R.id.btn_personal_main:
hideFragment(fragmentTransaction);
if (personalFragment != null) {
fragmentTransaction.show(personalFragment);
}else{
personalFragment = new PersonalFragment();
fragmentTransaction.add(R.id.main_container, personalFragment);
}
break;
}
fragmentTransaction.commit();
}
展开
 我来答
天街小雨润如意
2017-02-28 · TA获得超过104个赞
知道小有建树答主
回答量:262
采纳率:0%
帮助的人:252万
展开全部
1.无参数Activity跳转

Intent it = new Intent(Activity.Main.this, Activity2.class);
startActivity(it);

2.向下一个Activity传递数据(使用Bundle和Intent.putExtras)

Intent it = new Intent(Activity.Main.this, Activity2.class);
Bundle bundle=new Bundle();
bundle.putString("name", "This is from MainActivity!");
it.putExtras(bundle); // it.putExtra(“test”, "shuju”);
startActivity(it); // startActivityForResult(it,REQUEST_CODE);

对于数据的获取可以采用:

Bundle bundle=getIntent().getExtras();
String name=bundle.getString("name");

3.向上一个Activity返回结果(使用setResult,针对startActivityForResult(it,REQUEST_CODE)启动的Activity)

Intent intent=getIntent();
Bundle bundle2=new Bundle();
bundle2.putString("name", "This is from ShowMsg!");
intent.putExtras(bundle2);
setResult(RESULT_OK, intent);

4.回调上一个Activity的结果处理函数(onActivityResult)

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==REQUEST_CODE){
if(resultCode==RESULT_CANCELED)
setTitle("cancle");
else if (resultCode==RESULT_OK) {
String temp=null;
Bundle bundle=data.getExtras();
if(bundle!=null) temp=bundle.getString("name");
setTitle(temp);
}
}
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式