如何将扩展从AppCompatActivity更改为Fragment?

时间:2019-02-03 12:04:16

标签: java

我应该改变什么?因为如果将其更改为Fragment,我会发现很多错误。请检查我的代码并帮助我进行修复

这是包裹:

{2,2,12,12,yellow, Hi how are you}

这是我的课程:

package com.example.ashraf.myapplication;

import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.view.PagerAdapter;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.widget.TextView;

1 个答案:

答案 0 :(得分:0)

我建议您逐步将“活动”的代码复制到片段中。请参阅this Stackoverflow答案以获取有关如何将活动转换为片段的说明。