foronefighting
里奥文
2018-02-13 11:18

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

20
  • java
  • android

准备实现的功能是点击售后服务后跳转到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条回答

为你推荐