import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class RecordPagerAdapter extends FragmentPagerAdapter {
List<Fragment> fragmentList;
String []titles={"支出","收入"};
public RecordPagerAdapter(@NonNull @NotNull FragmentManager fm, List<Fragment> fragmentList) {
super(fm);
this.fragmentList = fragmentList;
}
@NonNull
@NotNull
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
}
标签:fragmentList,androidx,int,学习,position,2.17,import,Android,public From: https://www.cnblogs.com/dmx-03/p/18040257