小编Was*_* Ha的帖子

如何隐藏特定片段中的操作栏

我有片段 A , B , C , D 。我想隐藏片段 D 中的操作栏。

我试过了getActivity().getActionBar().hide();,但没有用。

public class Profile extends Fragment {

    public Profile() {
        // Required empty public constructor
    }

    public static Profile newInstance(int instance) {
        Bundle args = new Bundle();
        args.putInt("argsInstance", instance);
        Profile profile = new Profile();
        profile.setArguments(args);
        return profile;
    }

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

        getActivity().getActionBar().hide();


        // Inflate the layout for this fragment
        View profile = inflater.inflate(R.layout.fragment_profile, container, false);

        return profile;


    }

}
Run Code Online (Sandbox Code Playgroud)

java android-studio

7
推荐指数
1
解决办法
3291
查看次数

标签 统计

android-studio ×1

java ×1