问题
I'm look for the easiest way to get an ActionBar instance from a Fragment using AppCompatLibrary and API 8.
Already tried things like
getActivity().getSupportActionBar()
but no luck.
回答1:
Try to cast it:
((YourActivity)getActivity()).getSupportActionBar()
来源:https://stackoverflow.com/questions/17954471/getactionbar-from-fragment-with-appcompatlibrary