android.support.v4.widget.DrawerLayout.getDrawerTitle()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(103)

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

DrawerLayout.getDrawerTitle介绍

[英]Returns the title of the drawer with the given gravity.
[中]返回具有给定重力的抽屉的标题。

代码示例

代码示例来源:origin: willowtreeapps/Hyperion-Android

@NonNull
@Override
public List<ViewAttribute> collect(DrawerLayout view, AttributeTranslator attributeTranslator) {
  List<ViewAttribute> attributes = new ArrayList<>();
  attributes.add(new ViewAttribute<>("DrawerElevation", view.getDrawerElevation()));
  attributes.add(new ViewAttribute<>("DrawerTitleStart",
      view.getDrawerTitle(Gravity.START)));
  attributes.add(new ViewAttribute<>("DrawerTitleEnd",
      view.isDrawerVisible(Gravity.END)));
  attributes.add(new ViewAttribute<>("DrawerLockModeStart",
      new DrawerLayoutLockModeValue(view.getDrawerLockMode(Gravity.START))));
  attributes.add(new ViewAttribute<>("DrawerLockModeEnd",
      new DrawerLayoutLockModeValue(view.getDrawerLockMode(Gravity.END))));
  attributes.add(new ViewAttribute<>("DrawerOpenStart",
      view.isDrawerOpen(Gravity.START)));
  attributes.add(new ViewAttribute<>("DrawerOpenEnd",
      view.isDrawerOpen(Gravity.END)));
  attributes.add(new ViewAttribute<>("DrawerVisibleStart",
      view.isDrawerVisible(Gravity.START)));
  attributes.add(new ViewAttribute<>("DrawerVisibleEnd",
      view.isDrawerVisible(Gravity.END)));
  attributes.add(new ViewAttribute<Void>("StatusBarBackgroundDrawable",
      view.getStatusBarBackgroundDrawable()));
  return attributes;
}

代码示例来源:origin: kingargyle/adt-leanback-support

@Override
public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
  // Special case to handle window state change events. As far as
  // accessibility services are concerned, state changes from
  // DrawerLayout invalidate the entire contents of the screen (like
  // an Activity or Dialog) and they should announce the title of the
  // new content.
  if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
    final List<CharSequence> eventText = event.getText();
    final View visibleDrawer = findVisibleDrawer();
    if (visibleDrawer != null) {
      final int edgeGravity = getDrawerViewAbsoluteGravity(visibleDrawer);
      final CharSequence title = getDrawerTitle(edgeGravity);
      if (title != null) {
        eventText.add(title);
      }
    }
    return true;
  }
  return super.dispatchPopulateAccessibilityEvent(host, event);
}

相关文章