相关疑难解决方法(0)

如何在android FragmentPagerAdapter中添加页面标题和图标

我必须在标题页标题中显示带有相应图标的标题.喜欢这个图像.但只能显示标题而不是图标.

这是我所做的代码.

public class SectionsPagerAdapter extends FragmentPagerAdapter {

    public SectionsPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        // getItem is called to instantiate the fragment for the given page.
        // Return a DummySectionFragment (defined as a static inner class
        // below) with the page number as its lone argument.

        Log.e("POSITION", "position=" + position);
        Fragment fragment;
        switch (position) {
        case 0:
         //Fragment1
        case 1:
         //Fragment2
        case 2:
         //Fragment3
        case 3:
         //Fragment4
        case 4:
         //Fragment5

        }
        return null;

    } …
Run Code Online (Sandbox Code Playgroud)

android fragmentpageradapter

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

fragmentpageradapter ×1