Java Code Examples for android.support.v7.app.ActionBar#setHomeAsUpIndicator()
The following examples show how to use
android.support.v7.app.ActionBar#setHomeAsUpIndicator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From RetroFacebook with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.inject(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { setupViewPager(viewPager); } FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); }
Example 2
Source File: DrawerActivity.java From Companion-For-PUBG-Android with MIT License | 6 votes |
@Override protected final void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); actionBar.setDisplayHomeAsUpEnabled(true); } if (this.navigationView != null) { this.navigationView.setNavigationItemSelectedListener(this); this.navigationView.setCheckedItem(R.id.drawer_map); } mapSelected(); }
Example 3
Source File: NotesActivity.java From androidtestdebug with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notes); // Set up the toolbar. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); // Set up the navigation drawer. mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } if (null == savedInstanceState) { initFragment(NotesFragment.newInstance()); } }
Example 4
Source File: StatisticsActivity.java From android-espresso-revealed with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.statistics_act); // Set up the toolbar. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); ab.setTitle(R.string.statistics_title); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); // Set up the navigation drawer. mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } StatisticsFragment statisticsFragment = (StatisticsFragment) getSupportFragmentManager() .findFragmentById(R.id.contentFrame); if (statisticsFragment == null) { statisticsFragment = StatisticsFragment.newInstance(); ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), statisticsFragment, R.id.contentFrame); } new StatisticsPresenter( Injection.provideTasksRepository(getApplicationContext()), statisticsFragment); }
Example 5
Source File: ToolbarCancel.java From px-android with MIT License | 5 votes |
private void init() { final Activity activity = getActivity(); if (activity instanceof AppCompatActivity) { final AppCompatActivity appCompatActivity = (AppCompatActivity)activity; appCompatActivity.setSupportActionBar(this); final ActionBar supportActionBar = appCompatActivity.getSupportActionBar(); supportActionBar.setHomeAsUpIndicator(R.drawable.ic_close); supportActionBar.setHomeActionContentDescription(R.string.px_label_close); supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setDisplayShowTitleEnabled(false); setNavigationOnClickListener(v -> appCompatActivity.onBackPressed()); } }
Example 6
Source File: TasksActivity.java From android-espresso-revealed with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tasks_act); // Set up the toolbar. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); // Set up the navigation drawer. mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } TasksFragment tasksFragment = (TasksFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame); if (tasksFragment == null) { // Create the fragment tasksFragment = TasksFragment.newInstance(); ActivityUtils.addFragmentToActivity( getSupportFragmentManager(), tasksFragment, R.id.contentFrame); } // Create the presenter mTasksPresenter = new TasksPresenter( Injection.provideTasksRepository(getApplicationContext()), tasksFragment); // Load previously saved state, if available. if (savedInstanceState != null) { TasksFilterType currentFiltering = (TasksFilterType) savedInstanceState.getSerializable(CURRENT_FILTERING_KEY); mTasksPresenter.setFiltering(currentFiltering); } }
Example 7
Source File: NavigationViewActivity.java From Android_Blog_Demos with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.id_drawer_layout); mNavigationView = (NavigationView) findViewById(R.id.id_nv_menu); Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); setupDrawerContent(mNavigationView); }
Example 8
Source File: BaseScannerActivity.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
public void setupToolbar() { Toolbar toolbar = findViewById(R.id.scan_toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayShowTitleEnabled(false); ab.setHomeAsUpIndicator(R.drawable.ic_close_white); } }
Example 9
Source File: BrowserActivity.java From CoreModule with Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.browser_activity_layout); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.mipmap.browser_icon_delete); } initData(); }
Example 10
Source File: ExploreFragment.java From Loop with Apache License 2.0 | 5 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar(); if(ab != null){ ab.setHomeAsUpIndicator(R.drawable.ic_menu_light); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(TrestleUtility.getFormattedText(getString(R.string.explore), font)); } LinearLayoutManager layoutManager = new GridLayoutManager(getActivity(), 2); recyclerView.setLayoutManager(layoutManager); recyclerView.addItemDecoration(new GridSpacesItemDecoration(DisplayUtility.dp2px(getActivity(), 8))); categoriesAdapter = new CategoriesAdapter(); categoriesAdapter.setOnItemClickListener(this); recyclerView.setItemAnimator(new SlideInUpAnimator()); recyclerView.setAdapter(categoriesAdapter); Call getCategoriesCall = vimeoService.getCategories(); calls.add(getCategoriesCall); getCategoriesCall.enqueue(getCategoriesCallback); }
Example 11
Source File: AppListFragment.java From android-permission-checker-app with Apache License 2.0 | 5 votes |
private void setUpToolBar() { Toolbar toolbar = getActivity().findViewById(R.id.toolbar); toolbar.setTitle(""); titleTextView = toolbar.findViewById(R.id.toolbar_title); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); ActionBar supportActionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white); }
Example 12
Source File: AboutActivity.java From SuntimesWidget with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(AppSettings.loadTheme(this)); super.onCreate(savedInstanceState); setContentView(R.layout.layout_activity_about); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); int icon = R.drawable.ic_action_suntimes; Intent intent = getIntent(); if (intent != null) { icon = intent.getIntExtra(EXTRA_ICONID, icon); } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(icon); } pagerAdapter = new AboutPagerAdapter(getSupportFragmentManager()); viewPager = (ViewPager) findViewById(R.id.container); viewPager.setAdapter(pagerAdapter); tabs = (TabLayout) findViewById(R.id.tabs); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs)); tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager)); viewPager.post(new Runnable() { @Override public void run() { AppSettings.checkCustomPermissions(AboutActivity.this); } }); }
Example 13
Source File: SettingsActivity.java From android-design-template with Apache License 2.0 | 5 votes |
private void setupToolbar() { final ActionBar ab = getActionBarToolbar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); }
Example 14
Source File: NewsDetailActivity.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
private void initToolbar(){ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.icon_back); } }
Example 15
Source File: PicDetailActivity.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
@Override public void initView() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setHomeAsUpIndicator(R.drawable.icon_back); } mViewPager = (ViewPager) findViewById(R.id.vp_pic); }
Example 16
Source File: AppDetailsFragment.java From android-permission-checker-app with Apache License 2.0 | 5 votes |
private void setUpToolBar() { Toolbar toolbar = getActivity().findViewById(R.id.toolbar); toolbar.setTitle(""); TextView titleTextView = toolbar.findViewById(R.id.toolbar_title); titleTextView.setText("App Details"); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); ActionBar supportActionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white); }
Example 17
Source File: CollapsingToolbarLayoutActivity.java From DesignSupportDemo with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_collapsing_toolbar_layout); ButterKnife.bind(this); setSupportActionBar(toolBar); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(android.R.drawable.ic_input_delete); actionBar.setDisplayHomeAsUpEnabled(true); collapsingToolbar.setTitle("详情界面"); }
Example 18
Source File: FeedbackActivity.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
private void initToolbar(){ Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar); toolbar.setTitle(""); TextView toolbar_title = (TextView) findViewById(R.id.toolbar_title); toolbar_title.setText("信息反馈"); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.icon_back); } }
Example 19
Source File: GraphActivity.java From GraphView with Apache License 2.0 | 5 votes |
private void setupToolbar() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setHomeAsUpIndicator(R.drawable.ic_arrow_back); ab.setDisplayHomeAsUpEnabled(true); } }
Example 20
Source File: StatisticsActivity.java From mobius-android-sample with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.statistics_act); // Set up the toolbar. Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); ab.setTitle(R.string.statistics_title); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); // Set up the navigation drawer. mDrawerLayout = findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark); NavigationView navigationView = findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } StatisticsFragment statisticsFragment = (StatisticsFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame); if (statisticsFragment == null) { statisticsFragment = StatisticsFragment.newInstance(); ActivityUtils.addFragmentToActivity( getSupportFragmentManager(), statisticsFragment, R.id.contentFrame); } }