里奥文 2018-02-13 11:18 采纳率: 50%
浏览 2238
已结题

Android开发,从Fragment中跳转到其他Activity后只显示空白的活动

准备实现的功能是点击售后服务后跳转到Guarantee这个类中。
public class ThirdFragment extends Fragment implements View.OnClickListener{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.third_fragment, container, false);
LinearLayout guaranteell = (LinearLayout) view.findViewById(R.id.serviceGuaranteeId);
guaranteell.setOnClickListener(this);
return view;
}
@Override
public void onClick(View view){
Intent intent = new Intent(getActivity(), Guarantee.class);
startActivity(intent);

        Guarantee.class的代码如下

```public class Guarantee extends AppCompatActivity {

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = inflater.inflate(R.layout.activity_guarantee, container, false);
    //setContentView(R.layout.activity_guarantee);
    return view;
}

}```

图片说明

图片说明

  • 写回答

8条回答

  • LuoBinary 2018-02-13 13:31
    关注

    你的ThirdFragment 里面的onClick方法没有指定id,用view.getId()获取之后确定是哪一个view的点击事件。

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器