当前位置: 首页>>代码示例>>Java>>正文


Java ActionBar类代码示例

本文整理汇总了Java中android.support.v7.app.ActionBar的典型用法代码示例。如果您正苦于以下问题:Java ActionBar类的具体用法?Java ActionBar怎么用?Java ActionBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ActionBar类属于android.support.v7.app包,在下文中一共展示了ActionBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fullScreenMode

import android.support.v7.app.ActionBar; //导入依赖的package包/类
private void fullScreenMode(boolean fullScreen) {
    ActionBar actionBar = getSupportActionBar();
    isFullScreen = fullScreen;
    if(fullScreen) {
        if(actionBar != null) {
            actionBar.hide();
        }

        adjustActionBarWrap();
    } else {
        if(actionBar != null) {
            actionBar.show();
        }

        copyFab.hide();
        exitFab.hide();
        exitFullScreenFab.hide();
    }
    SPHelper.save(IS_FULL_SCREEN_COPY,fullScreen);
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:21,代码来源:CopyActivity.java

示例2: onCreate

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAdapter = new CheesesAdapter();

    final ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(mAdapter);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.search_view);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

    final EditText editText = (EditText) actionBar.getCustomView();
    editText.addTextChangedListener(mTextWatcher);
    editText.requestFocus();
}
 
开发者ID:cyrilmottier,项目名称:QueryHighlighter,代码行数:19,代码来源:MainActivity.java

示例3: onResume

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if(actionBar != null){
        actionBar.setTitle("likes".equals(getArguments().getString(Extra.FILTER)) ? R.string.like : R.string.shared);
        actionBar.setSubtitle(null);
    }

    new ActivityFeatures.Builder()
            .begin()
            .setBlockNavigationDrawer(false)
            .setStatusBarColored(true)
            .build()
            .apply(getActivity());
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:17,代码来源:LikesFragment.java

示例4: onCreate

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_postulaciones_activas);
    // Setting ViewPager for each Tabs
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_pa);
    setupViewPager(viewPager);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerpa);
    // Adding menu icon to Toolbar
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        VectorDrawableCompat indicator
                = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme());
        indicator.setTint(ResourcesCompat.getColor(getResources(),R.color.white,getTheme()));
        supportActionBar.setHomeAsUpIndicator(indicator);
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }

}
 
开发者ID:sloiza,项目名称:changApp,代码行数:20,代码来源:PostulacionesActivasActivity.java

示例5: handleStateChange

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
public void handleStateChange(@NonNull StateChange traversal, @NonNull final StateChanger.Callback callback) {
    Path path = traversal.topNewState();
    setTitle(path.getTitle());
    ActionBar actionBar = getSupportActionBar();
    boolean canGoBack = traversal.getNewState().size() > 1;
    actionBar.setDisplayHomeAsUpEnabled(canGoBack);
    actionBar.setHomeButtonEnabled(canGoBack);
    containerAsStateChanger.handleStateChange(traversal, new StateChanger.Callback() {
        @Override
        public void stateChangeComplete() {
            invalidateOptionsMenu();
            callback.stateChangeComplete();
        }
    });
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:17,代码来源:MainActivity.java

示例6: onCreate

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chuck_activity_transaction);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    title = (TextView) findViewById(R.id.toolbar_title);

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
    }

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    transactionId = getIntent().getLongExtra(ARG_TRANSACTION_ID, 0);
    getSupportLoaderManager().initLoader(0, null, this);
}
 
开发者ID:jgilfelt,项目名称:chuck,代码行数:24,代码来源:TransactionActivity.java

示例7: onCreate

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);


    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null){
        actionBar.setTitle("    设置");
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_back);
    }


    if (Build.VERSION.SDK_INT >= 21 && Build.VERSION.SDK_INT <23) {
        getWindow().setStatusBarColor(0x22000000);//浅黑
    } else if (Build.VERSION.SDK_INT >= 23) {
        View decorView = getWindow().getDecorView();
        decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }


}
 
开发者ID:YugengWang,项目名称:OneWeather,代码行数:25,代码来源:SettingActivity.java

示例8: initToolBar

import android.support.v7.app.ActionBar; //导入依赖的package包/类
/**
 * 初始化ToolBar
 *
 * @param toolbar ToolBar的实例
 * @param title 标题
 * @param isBack 是否出现返回按钮
 */
public void initToolBar(Toolbar toolbar, String title, boolean isBack) {
    toolbar.setTitle(title);
    setSupportActionBar(toolbar);
    if (isBack) {
        try {
            ActionBar actionBar = getSupportActionBar();
            if (null != actionBar)
                actionBar.setDisplayHomeAsUpEnabled(true);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }

}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:28,代码来源:BaseActivity.java

示例9: onResume

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    Settings.get().ui().notifyPlaceResumed(Place.DIALOGS);

    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if (actionBar != null) {
        actionBar.setTitle(R.string.dialogs);
        actionBar.setSubtitle(getArguments().getString(Extra.SUBTITLE));
    }

    if (getActivity() instanceof OnSectionResumeCallback) {
        ((OnSectionResumeCallback) getActivity()).onSectionResume(NavigationFragment.SECTION_ITEM_DIALOGS);
    }

    new ActivityFeatures.Builder()
            .begin()
            .setBlockNavigationDrawer(false)
            .setStatusBarColored(true)
            .build()
            .apply(getActivity());
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:23,代码来源:DialogsFragment.java

示例10: onCreate

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle("");
    mItemDescription = (TextView) findViewById(R.id.text_view_item_description);
    mItemPrice = (TextView) findViewById(R.id.text_view_item_price);
    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    setSupportActionBar(mToolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }
    fab.setOnClickListener(this);

    mItemId = getIntent().getIntExtra(INTENT_EXTRA_ITEM, 0);

    getSupportLoaderManager().initLoader(PLANT_DETAIL_LOADER, null, this);
}
 
开发者ID:laramartin,项目名称:android_firebase_green_thumb,代码行数:23,代码来源:PlantDetailActivity.java

示例11: onResume

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if(getActivity() instanceof OnSectionResumeCallback){
        ((OnSectionResumeCallback)getActivity()).onClearSelection();
    }

    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if(actionBar != null){
        actionBar.setSubtitle(null);
        actionBar.setTitle(R.string.title_mssages);
    }

    new ActivityFeatures.Builder()
            .begin()
            .setBlockNavigationDrawer(false)
            .setStatusBarColored(true)
            .build()
            .apply(getActivity());
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:21,代码来源:FwdsFragment.java

示例12: onCreateView

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_folders, container, false);

    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(R.string.folders);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    mProgressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);

    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    if (getActivity() != null)
        new loadFolders().execute("");
    return rootView;
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:24,代码来源:FoldersFragment.java

示例13: selectFavoriteProject

import android.support.v7.app.ActionBar; //导入依赖的package包/类
private void selectFavoriteProject() {

        if (!mNoProject) {
            mSelectedProfileIndex = getIndexOfFavorite();
            IProfile activeProfile = mProfiles.get(mSelectedProfileIndex);
            String activeProfileName = activeProfile.getName().getText();

            ActionBar bar;
            if ((bar = getSupportActionBar()) != null) {
                bar.setTitle(activeProfileName);
            }

            DataEntry.setTableName(activeProfileName);

            switchToProjectColors();
        }
    }
 
开发者ID:IdeaTrackerPlus,项目名称:IdeaTrackerPlus,代码行数:18,代码来源:MainActivity.java

示例14: onCreate

import android.support.v7.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(android.support.v7.app.ActionBar.NAVIGATION_MODE_TABS);

    SectionsPagerAdapter pageAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(pageAdapter);

    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    for (int i = 0; i < pageAdapter.getCount(); i++) {
        getSupportActionBar().addTab(getSupportActionBar().newTab()
                .setText(pageAdapter.getPageTitle(i))
                .setTabListener(this));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:ThreadExampleActivity.java

示例15: init

import android.support.v7.app.ActionBar; //导入依赖的package包/类
private void init(View view) {
    unbinder = ButterKnife.bind(this, view);

    activity = (AppCompatActivity) getActivity();

    activity.setSupportActionBar(toolbar);
    ActionBar actionBar = activity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(title);
    }

    LinearLayoutManager layoutManager
            = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(activity, layoutManager.getOrientation()));
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(genreAdapter);
}
 
开发者ID:prakh25,项目名称:MovieApp,代码行数:24,代码来源:GenreFragment.java


注:本文中的android.support.v7.app.ActionBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。