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


Java ViewCompat.setAccessibilityLiveRegion方法代码示例

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


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

示例1: setErrorEnabled

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void setErrorEnabled(boolean enabled) {
    if (this.mErrorEnabled != enabled) {
        if (this.mErrorView != null) {
            ViewCompat.animate(this.mErrorView).cancel();
        }
        if (enabled) {
            this.mErrorView = new TextView(getContext());
            try {
                this.mErrorView.setTextAppearance(getContext(), this.mErrorTextAppearance);
            } catch (Exception e) {
                this.mErrorView.setTextAppearance(getContext(), R.style.TextAppearance_AppCompat_Caption);
                this.mErrorView.setTextColor(ContextCompat.getColor(getContext(), R.color.design_textinput_error_color_light));
            }
            this.mErrorView.setVisibility(4);
            ViewCompat.setAccessibilityLiveRegion(this.mErrorView, 1);
            addIndicator(this.mErrorView, 0);
        } else {
            this.mErrorShown = false;
            updateEditTextBackground();
            removeIndicator(this.mErrorView);
            this.mErrorView = null;
        }
        this.mErrorEnabled = enabled;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:TextInputLayout.java

示例2: ToolbarProgressBar

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * Creates a toolbar progress bar.
 *
 * @param context the application environment.
 * @param attrs the xml attributes that should be used to initialize this view.
 */
public ToolbarProgressBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    setAlpha(0.0f);

    // This tells accessibility services that progress bar changes are important enough to
    // announce to the user even when not focused.
    ViewCompat.setAccessibilityLiveRegion(this, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:ToolbarProgressBar.java

示例3: SnackbarLayout

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public SnackbarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SnackbarLayout);
    this.mMaxWidth = a.getDimensionPixelSize(R.styleable.SnackbarLayout_android_maxWidth, -1);
    this.mMaxInlineActionWidth = a.getDimensionPixelSize(R.styleable.SnackbarLayout_maxActionInlineWidth, -1);
    if (a.hasValue(R.styleable.SnackbarLayout_elevation)) {
        ViewCompat.setElevation(this, (float) a.getDimensionPixelSize(R.styleable.SnackbarLayout_elevation, 0));
    }
    a.recycle();
    setClickable(true);
    LayoutInflater.from(context).inflate(R.layout.design_layout_snackbar_include, this);
    ViewCompat.setAccessibilityLiveRegion(this, 1);
    ViewCompat.setImportantForAccessibility(this, 1);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:Snackbar.java

示例4: BaseTransientBottomBar

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * Constructor for the transient bottom bar.
 *
 * @param parent The parent for this transient bottom bar.
 * @param content The content view for this transient bottom bar.
 * @param contentViewCallback The content view callback for this transient bottom bar.
 */
  protected BaseTransientBottomBar(@NonNull ViewGroup parent, @NonNull View content,
    @NonNull ContentViewCallback contentViewCallback) {
  if (parent == null) {
    throw new IllegalArgumentException("Transient bottom bar must have non-null parent");
  }
  if (content == null) {
    throw new IllegalArgumentException("Transient bottom bar must have non-null content");
  }
  if (contentViewCallback == null) {
    throw new IllegalArgumentException("Transient bottom bar must have non-null callback");
  }

  mTargetParent = parent;
  mContentViewCallback = contentViewCallback;
  mContext = parent.getContext();

  // ThemeUtils.checkAppCompatTheme(mContext);

  LayoutInflater inflater = LayoutInflater.from(mContext);
  // Note that for backwards compatibility reasons we inflate a layout that is defined
  // in the extending Snackbar class. This is to prevent breakage of apps that have custom
  // coordinator layout behaviors that depend on that layout.
      mView = (SnackbarBaseLayout) inflater.inflate(
              R.layout.design_layout_snackbar, mTargetParent, false);
  mView.addView(content);

      ViewCompat.setAccessibilityLiveRegion(mView,
              ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
      ViewCompat.setImportantForAccessibility(mView,
              ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

  // Make sure that we fit system windows and have a listener to apply any insets
  ViewCompat.setFitsSystemWindows(mView, true);
      ViewCompat.setOnApplyWindowInsetsListener(mView,
      new android.support.v4.view.OnApplyWindowInsetsListener() {
        @Override
                  public WindowInsetsCompat onApplyWindowInsets(View v,
                          WindowInsetsCompat insets) {
          // Copy over the bottom inset as padding so that we're displayed
          // above the navigation bar
                      v.setPadding(v.getPaddingLeft(), v.getPaddingTop(),
                              v.getPaddingRight(), insets.getSystemWindowInsetBottom());
          return insets;
        }
      });

      mAccessibilityManager = (AccessibilityManager)
              mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:57,代码来源:BaseTransientBottomBar.java


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