當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。