【问题标题】:How to Add swipeable tabs in fragments如何在片段中添加可滑动的标签
【发布时间】:2014-06-06 22:38:48
【问题描述】:

我有一个类,它是使用 android hive 代码here 制作的片段。现在,由于这里的每个类都扩展了片段,我想在代码的一个类中实现this。假设 Home 类是我想显示包含多个选项的选项卡的地方,比如电影、游戏等。这是否可能,它说要实现 Actionbar.tab 侦听器,但这是不可用的。

这里是 Home 片段的代码:

HomeFragment.java

package info.androidhive.slidingmenu;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class HomeFragment extends Fragment {

    public HomeFragment(){}

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_home, container, false);

        return rootView;
    }
}

现在我想在这个主页片段中实现选项卡。请回答。提前谢谢。

【问题讨论】:

    标签: java android android-fragments tabs android-actionbar


    【解决方案1】:

    我已经使用这个库来满足这个要求

    https://github.com/astuetz/PagerSlidingTabStrip

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-27
      • 1970-01-01
      • 2014-02-27
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多