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


Java Toolbar.setNavigationOnClickListener方法代码示例

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


在下文中一共展示了Toolbar.setNavigationOnClickListener方法的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: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_profile);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    mToolbar = (Toolbar) findViewById(R.id.toolbar_user_profile);
    mToolbar.setTitle("");
    setSupportActionBar(mToolbar);
    // Set mToolbar for this screen
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            exit();
        }
    });
    initUI();
    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
}
 
开发者ID:Welloculus,项目名称:MobileAppForPatient,代码行数:22,代码来源:UserProfilesActivity.java

示例3: onCreate

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

    final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
    if (isFirstEnter) {
        isFirstEnter = false;
        refreshLayout.autoRefresh();
    }

}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:21,代码来源:FeedlistPracticeActivity.java

示例4: TitleLayout

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public TitleLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater.from(context).inflate(R.layout.include_title_layout, this);
    //
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    //
    ((AppCompatActivity) getContext()).setSupportActionBar(toolbar);
    ActionBar actionBar = ((AppCompatActivity) getContext()).getSupportActionBar();
    if (actionBar != null) {
        //是否显示默认Title
        actionBar.setDisplayShowTitleEnabled(true);
        //是否显示返回键
        actionBar.setDisplayHomeAsUpEnabled(true);
        //监听返回键
        toolbar.setNavigationOnClickListener(view -> ((AppCompatActivity) getContext()).onBackPressed());
    }
}
 
开发者ID:zhao-mingjian,项目名称:qvod,代码行数:18,代码来源:TitleLayout.java

示例5: initializeToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initializeToolbar() {
    Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(mToolbar);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("");
    final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_black_24dp);
    getSupportActionBar().setHomeAsUpIndicator(upArrow);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:17,代码来源:PublicationActivity.java

示例6: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_view_picture);
	Intent intent = getIntent();
	userHasSigned = (UserHasSigned) intent.getSerializableExtra("userHasSigned");
	faceTokenAndUrl = intent.getStringExtra("faceTokenAndUrl");
	imageView_face = (ImageView) findViewById(R.id.imageView_face);
	toolbar = (Toolbar) findViewById(R.id.toolbar_view_picture);
	toolbar.setNavigationIcon(R.mipmap.button_back);
	toolbar.setNavigationOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View view) {
			finish();
		}
	});
	toolbar.setTitle(userHasSigned.getUser_name()+"的人脸照片");
	toolbar.inflateMenu(R.menu.base_toolbar_menu);

	startViewPicture();
}
 
开发者ID:tony-Shx,项目名称:Swface,代码行数:22,代码来源:ViewPictureActivity.java

示例7: onCreateView

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.acquire_fragment, container, false);
    mErrorTextView = (TextView) root.findViewById(R.id.error_textview);
    mRecyclerView = (RecyclerView) root.findViewById(R.id.list);
    mLoadingView = root.findViewById(R.id.screen_wait);
    // Setup a toolbar for this fragment
    Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_up);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    toolbar.setTitle(R.string.button_purchase);
    setWaitScreen(true);
    onManagerReady((BillingProvider) getActivity());
    return root;
}
 
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:22,代码来源:AcquireFragment.java

示例8: initializeToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initializeToolbar() {
    Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(mToolbar);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("");
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:15,代码来源:TripsListActivity.java

示例9: initToolBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initToolBar(Toolbar toolbarDoubanDetail, String title) {
    setSupportActionBar(toolbarDoubanDetail);
    toolbarDoubanDetail.setTitle(title);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.mipmap.icon_back);
    }
    toolbarDoubanDetail.setTitleTextColor(Color.WHITE);
    toolbarDoubanDetail.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });
    toolbarDoubanDetail.setTitleTextAppearance(this, R.style.ToolBar_Title);
    toolbarDoubanDetail.setSubtitleTextAppearance(this, R.style.Toolbar_SubTitle);
    toolbarDoubanDetail.inflateMenu(R.menu.base_header_menu);
    toolbarDoubanDetail.setOverflowIcon(getDrawable(R.mipmap.actionbar_more));
    toolbarDoubanDetail.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.actionbar_more:// 更多信息
                    setTitleClickMore();
                    break;
            }
            return true;
        }
    });
}
 
开发者ID:paterWang,项目名称:EasyReader,代码行数:34,代码来源:MovieTopDetailActivity.java

示例10: createToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void createToolbar() {
    Toolbar bar = (Toolbar) findViewById(R.id.nav_top_bar);
    setSupportActionBar(bar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.boxing_default_album);
    bar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
}
 
开发者ID:Bilibili,项目名称:boxing,代码行数:13,代码来源:BoxingBottomSheetActivity.java

示例11: onCreate

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

    progressBar=(ProgressBar) findViewById(R.id.feed_progress);
    toolbar= (Toolbar) findViewById(R.id.feed_toolbar);
    toolbar.setNavigationIcon(R.drawable.backbutton);
    FacebookSdk.sdkInitialize(getApplicationContext());
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    lvfeed= (ListView) findViewById(R.id.feed_list);
    ConnectionDetector ob=new ConnectionDetector(getApplicationContext());
  //  if (!ob.isConnecting())
  //  {
   //     Toast.makeText(getApplicationContext(),"Please connect to Internet",Toast.LENGTH_LONG).show();
  //  }
   // else{
    new Background().execute(FEED_URl);
//}
}
 
开发者ID:rishabh115,项目名称:Odyssey2017,代码行数:28,代码来源:FeedActivity.java

示例12: SideMenuToggle

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
     * In the future, we can make this constructor public if we want to let developers customize
     * the
     * animation.
     */
    <T extends Drawable & DrawerToggle> SideMenuToggle(Activity activity, Toolbar toolbar,
                                                       SideMenu drawerLayout, T slider,
                                                       @StringRes int openDrawerContentDescRes,
                                                       @StringRes int closeDrawerContentDescRes) {
        if (toolbar != null) {
            mActivityImpl = new ToolbarCompatDelegate(toolbar);
            toolbar.setNavigationOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mDrawerIndicatorEnabled) {
                        toggle();
                    } else if (mToolbarNavigationClickListener != null) {
                        mToolbarNavigationClickListener.onClick(v);
                    }
                }
            });
//        } else if (activity instanceof DelegateProvider) { // Allow the Activity to provide an impl
//            mActivityImpl = ((DelegateProvider) activity).getDrawerToggleDelegate();
//        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
//            mActivityImpl = new JellybeanMr2Delegate(activity);
//        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
//            mActivityImpl = new HoneycombDelegate(activity);
        } else {
            mActivityImpl = new DummyDelegate(activity);
        }
        mDrawerLayout = drawerLayout;
        mOpenDrawerContentDescRes = openDrawerContentDescRes;
        mCloseDrawerContentDescRes = closeDrawerContentDescRes;
        if (slider == null) {
            mSlider = new DrawerArrowDrawableToggle(activity,
                    mActivityImpl.getActionBarThemedContext());
        } else {
            mSlider = slider;
        }
        mHomeAsUpIndicator = getThemeUpIndicator();
    }
 
开发者ID:chemickypes,项目名称:Glitchy,代码行数:42,代码来源:SideMenuToggle.java

示例13: initToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void initToolbar(Toolbar toolBar) {
    setSupportActionBar(toolBar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    toolBar.setNavigationIcon(R.drawable.ic_menu);
    toolBar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDataBinding.drawerLayout.openDrawer(GravityCompat.START);
        }
    });
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:13,代码来源:MainActivity.java

示例14: onCreate

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

  toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle(R.string.w3cplus);
  toolbar.setNavigationOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      W3cplusActivity.this.finish();
    }
  });
  toolbar.setOnClickListener(new DoubleClickBackToContentTopListener(this));

  refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refresh_layout);
  listView = (ListView) findViewById(R.id.list_view);
  adapter = new MyBaseAdapter<Map<String, Object>>(this, data) {
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = ViewHolder.get(context, convertView, parent, R.layout.list_view_item_w3cplus, position);
      Map<String, Object> map = _data.get(position);
      holder.setText(R.id.title, map.get("title").toString())
          .setText(R.id.time, map.get("time").toString())
          .setText(R.id.desc, map.get("desc").toString())
          .setText(R.id.author, map.get("author").toString());
      return holder.getConvertView();
    }
  };
  listView.setAdapter(adapter);
  loadMoreFooter = new LoadMoreFooter(this, listView, this);

  refreshLayout.setOnRefreshListener(this);
  listView.setOnItemClickListener(this);

  refreshLayout.setRefreshing(true);
  initData();
}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:39,代码来源:W3cplusActivity.java

示例15: onCreateView

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_user_info, container, false);
    arguments = getArguments();
    email = arguments.getString(EMAIL_BUNDLE_KEY);
    phone = arguments.getString(PHONE_BUNDLE_KEY);
    website = arguments.getString(WEBSITE_BUNDLE_KEY);
    fullName = arguments.getString(FULL_NAME_BUNDLE_KEY);
    presenter.setUserId(arguments.getLong(ID_BUNDLE_KEY));

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.user_toolbar);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(toolbar.getContext(),
            null, android.support.v7.appcompat.R.styleable.ActionBar, android.support.v7.appcompat.R.attr.actionBarStyle, 0);
    toolbar.setNavigationIcon(a.getDrawable(android.support.v7.appcompat.R.styleable.ActionBar_homeAsUpIndicator));
    toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());

    toolbarLayout = (CollapsingToolbarLayout) view.findViewById(R.id.user_collapsing_toolbar_layout);
    emailTextView = (TextView) view.findViewById(R.id.user_info_email_value);
    phoneTextView = (TextView) view.findViewById(R.id.user_info_phone_value);
    websiteTextView = (TextView) view.findViewById(R.id.user_info_website_value);
    userInfoFab = (FloatingActionButton) view.findViewById(R.id.user_info_fab);
    toolbarLayout.setTitleEnabled(true);
    toolbarLayout.setTitle(fullName);

    view.findViewById(R.id.user_info_email_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_phone_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_website_layout).setOnClickListener(this);
    userInfoFab.setOnClickListener(this);

    if (presenter.isCurrentUser()) {
        userInfoFab.setVisibility(View.GONE);
    }

    packageManager = getActivity().getPackageManager();

    return view;
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:39,代码来源:UserInfoFragment.java


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