android官方API之AppCompatActivity
來源:https://developer.android.com/reference/android/support/v7/app/AppCompatActivity
AppCompatActivity
public class AppCompatActivity
extends FragmentActivity
implements AppCompatCallback, TaskStackBuilder.SupportParentable,ActionBarDrawerToggle.DelegateProvider
java.lang.Object | ||||||
↳ | android.content.Context | |||||
↳ | android.content.ContextWrapper | |||||
↳ | android.view.ContextThemeWrapper | |||||
↳ | android.app.Activity | |||||
↳ | android.support.v4.app.FragmentActivity | |||||
↳ | android.support.v7.app.AppCompatActivity |
Base class for activities that use the support library action bar features.
You can add an ActionBar
to your activity when running on API level 7 or higher by extending this class for your activity and setting the activity theme to Theme.AppCompat
or a similar theme.
Developer Guides
For information about how to use the action bar, including how to add action items, navigation modes and more, read the Action Bar API guide.
Summary
Inherited fields |
||
---|---|---|
From class android.app.Activity
|
Public constructors |
|
---|---|
AppCompatActivity() |
Public methods |
|
---|---|
void |
addContentView(View view, ViewGroup.LayoutParams params) |
void |
closeOptionsMenu() |
boolean |
dispatchKeyEvent(KeyEvent event) |
<T extends View> T |
findViewById(int id) |
AppCompatDelegate |
getDelegate() |
ActionBarDrawerToggle.Delegate |
getDrawerToggleDelegate() |
MenuInflater |
getMenuInflater() |
Resources |
getResources() |
ActionBar |
getSupportActionBar() Support library version of |
Intent |
getSupportParentActivityIntent() Obtain an |
void |
invalidateOptionsMenu() |
void |
onConfigurationChanged(Configuration newConfig) Dispatch configuration change to all fragments. |
void |
onContentChanged() |
void |
onCreateSupportNavigateUpTaskStack(TaskStackBuilder builder) Support version of |
boolean |
onKeyDown(int keyCode, KeyEvent event) |
final boolean |
onMenuItemSelected(int featureId, MenuItem item) Dispatch context and options menu to fragments. |
boolean |
onMenuOpened(int featureId, Menu menu)
Please note: AppCompat uses its own feature id for the action bar: |
void |
onPanelClosed(int featureId, Menu menu) Call onOptionsMenuClosed() on fragments. Please note: AppCompat uses its own feature id for the action bar: |
void |
onPrepareSupportNavigateUpTaskStack(TaskStackBuilder builder) Support version of |
void |
onSupportActionModeFinished(ActionMode mode) Notifies the activity that a support action mode has finished. |
void |
onSupportActionModeStarted(ActionMode mode) Notifies the Activity that a support action mode has been started. |
void |
onSupportContentChanged() This method was deprecated in API level 25.1.0. Use |
boolean |
onSupportNavigateUp() This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar. |
ActionMode |
onWindowStartingSupportActionMode(ActionMode.Callback callback) Called when a support action mode is being started for this window. |
void |
openOptionsMenu() |
void |
setContentView(View view) |
void |
setContentView(int layoutResID) |
void |
setContentView(View view, ViewGroup.LayoutParams params) |
void |
setSupportActionBar(Toolbar toolbar) Set a |
void |
setSupportProgress(int progress) This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat. |
void |
setSupportProgressBarIndeterminate(boolean indeterminate) This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat. |
void |
setSupportProgressBarIndeterminateVisibility(boolean visible) This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat. |
void |
setSupportProgressBarVisibility(boolean visible) This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat. |
void |
setTheme(int resid) |
ActionMode |
startSupportActionMode(ActionMode.Callback callback) Start an action mode. |
void |
supportInvalidateOptionsMenu() This method is deprecated. Call |
void |
supportNavigateUpTo(Intent upIntent) Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process. |
boolean |
supportRequestWindowFeature(int featureId) Enable extended support library window features. |
boolean |
supportShouldUpRecreateTask(Intent targetIntent) Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent. |
Protected methods |
|
---|---|
void |
onCreate(Bundle savedInstanceState) Perform initialization of all fragments. |
void |
onDestroy() Destroy all fragments. |
void |
onPostCreate(Bundle savedInstanceState) |
void |
onPostResume() Dispatch onResume() to fragments. |
void |
onSaveInstanceState(Bundle outState) Save all appropriate fragment state. |
void |
onStart() Dispatch onStart() to all fragments. |
void |
onStop() Dispatch onStop() to all fragments. |
void |
onTitleChanged(CharSequence title, int color) |
Inherited methods |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class android.support.v4.app.FragmentActivity
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class android.app.Activity
|