androidx.appcompat.widget.Toolbar.getContext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中androidx.appcompat.widget.Toolbar.getContext()方法的一些代码示例,展示了Toolbar.getContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getContext()方法的具体详情如下:
包路径:androidx.appcompat.widget.Toolbar
类名称:Toolbar
方法名:getContext

Toolbar.getContext介绍

暂无

代码示例

代码示例来源:origin: klinker24/Android-DragDismissActivity

public ToolbarScrollListener(Toolbar toolbar, View statusBar, int primaryColor) {
  this.toolbar = toolbar;
  this.statusBar = statusBar;
  this.primaryColor = primaryColor;
  this.transparentColor = toolbar.getContext().getResources()
      .getColor(R.color.dragdismiss_toolbarBackground);
  this.minDistance = toolbar.getContext().getResources()
      .getDimensionPixelSize(R.dimen.dragdismiss_minToolbarScroll);
  this.topOffset = toolbar.getContext().getResources()
      .getDimensionPixelSize(R.dimen.dragdismiss_scrollViewTop);
}

代码示例来源:origin: cbeyls/fosdem-companion-android

toolbar.setTitle(roomName);
if (!TextUtils.isEmpty(roomName)) {
  final Context context = toolbar.getContext();
  FosdemApi.getRoomStatuses(toolbar.getContext()).observe(owner, new Observer<Map<String, RoomStatus>>() {
    @Override
    public void onChanged(Map<String, RoomStatus> roomStatuses) {

代码示例来源:origin: MCMrARM/revolution-irc

static void setupTheming(Toolbar toolbar, LiveThemeComponent component, AttributeSet attrs, int defStyleAttr) {
  Resources.Theme t = component.getTheme();
  StyledAttributesHelper r = StyledAttributesHelper.obtainStyledAttributes(toolbar.getContext(), t, attrs, THEME_ATTRS, defStyleAttr);
  StyledAttributesHelper textAppearance = r.obtainChildAttrs(t, R.attr.titleTextAppearance, ThemedTextView.TEXT_APPEARANCE_ATTRS);
  component.addColorAttr(textAppearance, android.R.attr.textColor, toolbar::setTitleTextColor, (ColorStateList l) -> toolbar.setTitleTextColor(l.getDefaultColor()));
  textAppearance.recycle();
  r.recycle();
}

代码示例来源:origin: MCMrARM/revolution-irc

public ActionBarDrawerToggle(Toolbar toolbar, LockableDrawerLayout drawerLayout,
               int openTextId, int closeTextId) {
  mDrawable = new DrawerArrowDrawable(toolbar.getContext());
  mToolbar = toolbar;
  mOpenTextId = openTextId;
  mCloseTextId = closeTextId;
  drawerLayout.addDrawerListener(this);
  toolbar.setNavigationIcon(mDrawable);
  toolbar.setNavigationContentDescription(drawerLayout.isDrawerOpen(Gravity.START)
      ? closeTextId : openTextId);
  toolbar.setNavigationOnClickListener((View view) -> {
    if (drawerLayout.isDrawerOpen(Gravity.START))
      drawerLayout.closeDrawer(Gravity.START, !drawerLayout.isCurrentlyLocked());
    else
      drawerLayout.openDrawer(Gravity.START, !drawerLayout.isCurrentlyLocked());
    drawerLayout.requestLayout();
  });
  mOpenTextId = openTextId;
  mCloseTextId = closeTextId;
}

相关文章