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


Java Toolbar.findViewById方法代码示例

本文整理汇总了Java中android.support.v7.widget.Toolbar.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.findViewById方法的具体用法?Java Toolbar.findViewById怎么用?Java Toolbar.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.widget.Toolbar的用法示例。


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

示例1: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void setupToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    TextView toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
    Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/JosefinSans.ttf");
    toolbarTitle.setTypeface(myTypeface);


    toolbar.setNavigationIcon(R.drawable.ic_menu_white);


    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDrawer.toggleMenu();
        }
    });
}
 
开发者ID:akashdeepsingh9988,项目名称:Cybernet-VPN,代码行数:19,代码来源:NewMainActivity.java

示例2: ToolbarHelper

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public ToolbarHelper(Toolbar toolbar) throws IllegalAccessException {
    this.toolbar = toolbar;
    context = toolbar.getContext();
    leftBtn = (ImageView) toolbar.findViewById(R.id.left_button);
    rightBtn = (TextView) toolbar.findViewById(R.id.right_button);
    if (rightBtn == null) {
        throw new IllegalAccessException("Can't find this right button");
    }
    if (leftBtn == null) {
        throw new IllegalAccessException("Can't find this Left button");
    }
    tvTitle = (TextView) toolbar.findViewById(R.id.tvTitleToolbar);
    if (tvTitle == null) {
        throw new IllegalAccessException("Can't find this Title TextView");
    }
}
 
开发者ID:harrylefit,项目名称:eazycore,代码行数:17,代码来源:ToolbarHelper.java

示例3: ToolbarHelper

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public ToolbarHelper(Toolbar toolbar) throws IllegalAccessException {
    this.toolbar = toolbar;
    context = toolbar.getContext();
    leftBtn = (AppCompatTextView) toolbar.findViewById(R.id.left_button);
    rightBtn = (AppCompatTextView) toolbar.findViewById(R.id.right_button);
    if (rightBtn == null) {
        throw new IllegalAccessException("Can't find this right button.");
    } else {
        rightBtn.setClickable(true);
    }
    if (leftBtn == null) {
        throw new IllegalAccessException("Can't find this Left button");
    } else {
        leftBtn.setClickable(true);
    }
    tvTitle = (AppCompatTextView) toolbar.findViewById(R.id.tvTitleToolbar);
    if (tvTitle == null) {
        throw new IllegalAccessException("Can't find this Title TextView");
    } else {
        tvTitle.setClickable(true);
    }
}
 
开发者ID:harrylefit,项目名称:EazyBaseMVP,代码行数:23,代码来源:ToolbarHelper.java

示例4: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupToolbar(String title, String subTitle, boolean homeButtonEnabled) {

        toolbar = (Toolbar) findViewById(R.id.toolbar_layout);
        textView = (TextView) toolbar.findViewById(R.id.toolbar_title);
        toolbar.setTitle("");
        toolbarIcon = (RoundedImageView) toolbar.findViewById(R.id.toolbar_icon);

        if (!HTTextUtils.isEmpty(title)) {
            textView.setText(title);
        }

        if (!HTTextUtils.isEmpty(subTitle)) {
            textView.setText(subTitle);
        }

        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(homeButtonEnabled);
        getSupportActionBar().setHomeButtonEnabled(homeButtonEnabled);
    }
 
开发者ID:hypertrack,项目名称:hypertrack-live-android,代码行数:20,代码来源:BaseActivity.java

示例5: fixTitlebarColor

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void fixTitlebarColor(Toolbar toolbar, Context context) {
    int textColor = 0;
    if(SDK_INT <= 23) {
        textColor = Color.parseColor("#ffffffff");
    } else {
        textColor = context.getColor(R.color.editTitlebarTextColor);
    }
    toolbar.setTitleTextColor(textColor);
    TextView saveItem  = (TextView) toolbar.findViewById(R.id.save_menu);
    saveItem.setTextColor(textColor);

}
 
开发者ID:theScrabi,项目名称:OCBookmarks,代码行数:13,代码来源:EditBookmarkDialog.java

示例6: setupAppBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupAppBar() {
    setStatusBarColor(this.mStatusBarColor);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(this.mToolbarColor);
    toolbar.setTitleTextColor(this.mToolbarTextColor);
    TextView toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
    toolbarTitle.setTextColor(this.mToolbarTextColor);
    toolbarTitle.setText(this.mToolbarTitle);
    Drawable stateButtonDrawable = ContextCompat.getDrawable(this, R.drawable.ucrop_ic_cross)
            .mutate();
    stateButtonDrawable.setColorFilter(this.mToolbarTextColor, Mode.SRC_ATOP);
    toolbar.setNavigationIcon(stateButtonDrawable);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:UCropActivity.java

示例7: bindView

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void bindView(){
    btnClose = (Button) findViewById( R.id.btn_close );
    rvOrder = (RecyclerView) findViewById( R.id.rv_order );
    tvTotalPrice = (TextView) findViewById( R.id.tv_total_price );
    tvDate = (TextView) findViewById( R.id.tv_date );
    toolbar = (Toolbar) findViewById( R.id.toolbar );
    btnBack = (ImageView) toolbar.findViewById( R.id.toolbar_back );
}
 
开发者ID:TheKhaeng,项目名称:nongbeer-mvp-android-demo,代码行数:10,代码来源:OrderDetailActivity.java

示例8: setUpToolBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setUpToolBar() {
  Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
  TextView titleTextView = toolbar.findViewById(R.id.toolbar_title);
  titleTextView.setText("Permission Groups");
  toolbar.setTitle("");
  ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
  ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
}
 
开发者ID:Arjun-sna,项目名称:android-permission-checker-app,代码行数:9,代码来源:PermissionListFragment.java

示例9: setUpToolBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
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);
}
 
开发者ID:Arjun-sna,项目名称:android-permission-checker-app,代码行数:10,代码来源:AppListFragment.java

示例10: onCreate

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

    mToolbar = (Toolbar) findViewById(R.id.toolbar);


    titleTV=(TextView)mToolbar.findViewById(R.id.toolbar_center_title);

    titleTV.setText("FlyToCartAnimation");

    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    List<Product> list = makeProductsList();

    ProductAdapter adapter = new ProductAdapter(this, list);
    mRecyclerView.setAdapter(adapter);
    adapter.setActionListener(new ProductAdapter.ProductItemActionListener() {
        @Override
        public void onItemTap(ImageView imageView) {
            if (imageView != null)
                makeFlyAnimation(imageView);
        }
    });

}
 
开发者ID:matrixdevz,项目名称:FlyToCartAnimation,代码行数:29,代码来源:MainActivity.java

示例11: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbar(int toolbarId, String titleToolbar){
    toolbar = (Toolbar) findViewById(toolbarId);
    toolbar.setContentInsetsAbsolute(0,0);

    TextView title = (TextView) toolbar.findViewById(R.id.tv_title);
    title.setText(titleToolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle("");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
}
 
开发者ID:ahmadnurhidayat,项目名称:TravelJournal,代码行数:12,代码来源:BaseActivity.java

示例12: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public final void setupToolbar(int toolbarId, String titlePage){
    toolbar = (Toolbar) findViewById(toolbarId);
    setSupportActionBar(toolbar);

    title = (TextView) toolbar.findViewById(R.id.tv_title);
    title.setText(titlePage);

    getSupportActionBar().setTitle("");
}
 
开发者ID:ahmadnurhidayat,项目名称:Messenger-Android-XML-Template,代码行数:10,代码来源:BaseActivity.java

示例13: setupToolbarWithUpNav

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbarWithUpNav(int toolbarId, String titlePage, @DrawableRes int res){
    toolbar = (Toolbar) findViewById(toolbarId);
    setSupportActionBar(toolbar);

    title = (TextView) toolbar.findViewById(R.id.tv_title);
    title.setText(titlePage);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(res);
    getSupportActionBar().setTitle("");
}
 
开发者ID:ahmadnurhidayat,项目名称:Messenger-Android-XML-Template,代码行数:12,代码来源:BaseActivity.java

示例14: getViews

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void getViews() {
    mShadeLayer = findViewById(R.id.shade_layer);
    mContentLayout = (RelativeLayout) findViewById(R.id.include);
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mShareBtn = (ImageView) mToolBar.findViewById(R.id.iv_share);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mTabLayout = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    mViewPager = (ViewPager) findViewById(R.id.pager);

    mMenuBtn = (ImageView) findViewById(R.id.iv_menu);
    mCollectionLayout = (RelativeLayout) findViewById(R.id.rl_my_collection);
    mFeedbackLayout = (RelativeLayout) findViewById(R.id.rl_feedback);
    mClearCacheLayout = (RelativeLayout) findViewById(R.id.rl_clear_cache);
    rl_map = (RelativeLayout) findViewById(R.id.rl_map);
    rl_favourable = (RelativeLayout) findViewById(R.id.rl_favourable);
    size = (TextView)findViewById(R.id.size);
    version_code = (TextView)findViewById(R.id.version_code);
    mHelpLayout = (RelativeLayout) findViewById(R.id.rl_help);
    mCheckUpLayout = (RelativeLayout) findViewById(R.id.rl_checkup);
    recommend_la = (RelativeLayout) findViewById(R.id.recommend_la);
    logo_la = (RelativeLayout) findViewById(R.id.logo_la);
    la = (RelativeLayout) findViewById(R.id.la);
    mParentLayout = (CoordinatorLayout) findViewById(R.id.parent_layout);
    mCategoryNameLabel = (TextView) findViewById(R.id.tv_category_name);

    mShadeLayout = (RelativeLayout) findViewById(R.id.shade);
    mShadeViewPager = (ViewPager) findViewById(R.id.pager_shade);
    mShadeTabContainer = (PagerSlidingTabStrip) findViewById(R.id.tabs_shade);
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:31,代码来源:HotspotMainActivity.java

示例15: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbar(int toolbarId, String title, @ColorRes int titleColor, @ColorRes int colorBg, @DrawableRes int burger){
    toolbar = (Toolbar) findViewById(toolbarId);
    toolbar.setBackgroundColor(getResources().getColor(colorBg));
    setSupportActionBar(toolbar);
    TextView pageTitle = (TextView) toolbar.findViewById(R.id.tv_title);
    pageTitle.setText(title);
    pageTitle.setTextColor(getResources().getColor(titleColor));
    getSupportActionBar().setTitle("");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(burger);
}
 
开发者ID:ahmadnurhidayat,项目名称:Cook-It-Android-XML-Template,代码行数:12,代码来源:BaseActivity.java


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