在fragment中调用getSupportActionBar (com.android.support:appcompat-v7)

 
  
if someone uses com.android.support:appcompat-v7: and AppCompatActivity as activity then this works
android.support.v7.app.ActionBar actionbar=((AppCompatActivity)getActivity()).getSupportActionBar();
if(actionbar==null)
    Toast.makeText(getActivity(), "NULL", Toast.LENGTH_SHORT).show();
else
    Toast.makeText(getActivity(), "Not NULL", Toast.LENGTH_SHORT).show();
 
 

你可能感兴趣的:(Android,Basic,Technology)