當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessibilityDelegateCompat類代碼示例

本文整理匯總了Java中android.support.v4.view.AccessibilityDelegateCompat的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityDelegateCompat類的具體用法?Java AccessibilityDelegateCompat怎麽用?Java AccessibilityDelegateCompat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AccessibilityDelegateCompat類屬於android.support.v4.view包,在下文中一共展示了AccessibilityDelegateCompat類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getView

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
@Override
public View getView(final LayoutInflater inflater, ViewGroup container, Context context) {
    View view = inflater.inflate(R.layout.test_role_description, container, false);
    AccessibilityDelegateCompat buttonDelegate = new AccessibilityDelegateCompat() {
        @Override
        public void onInitializeAccessibilityNodeInfo(View host,
                                                      AccessibilityNodeInfoCompat info) {
            super.onInitializeAccessibilityNodeInfo(host, info);
            info.setRoleDescription(getString(R.string.role_entry_point));
        }
    };
    View mailButton = view.findViewById(R.id.test_role_description_mailButton);
    mailButton.setContentDescription(getString(R.string.role_send_email));
    ViewCompat.setAccessibilityDelegate(mailButton, buttonDelegate);

    View playButton = view.findViewById(R.id.test_role_description_playButton);
    playButton.setContentDescription(getString(R.string.role_send_email));
    ViewCompat.setAccessibilityDelegate(playButton, buttonDelegate);

    View lockButton = view.findViewById(R.id.test_role_description_lockButton);
    lockButton.setContentDescription(getString(R.string.role_lock_screen));
    ViewCompat.setAccessibilityDelegate(lockButton, buttonDelegate);

    return view;
}
 
開發者ID:google,項目名稱:talkback,代碼行數:26,代碼來源:RoleDescriptionTest.java

示例2: installAccessibilityDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
private void installAccessibilityDelegate() {
	// The accessibility delegate enables customizing accessibility behavior
	// via composition as opposed as inheritance. The main benefit is that
	// one can write a backwards compatible application by setting the delegate
	// only if the API level is high enough i.e. the delegate is part of the APIs.
	// The easiest way to achieve that is by using the support library which
	// takes the burden of checking API version and knowing which API version
	// introduced the delegate off the developer.
	ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegateCompat() {

		@Override
		public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
			super.onInitializeAccessibilityEvent(host, event);
			// Note that View.onInitializeAccessibilityNodeInfo was introduced in
			// ICS and we would like to tweak a bit the text that is reported to
			// accessibility services via the AccessibilityNodeInfo.
			if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED) {
				event.setFromIndex(0);
			}
		}

	});
}
 
開發者ID:RedInput,項目名稱:DateTimePickerCompat,代碼行數:24,代碼來源:YearPickerView.java

示例3: onFinishInflate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
protected void onFinishInflate()
{
  super.onFinishInflate();
  this.mTitleRecycler = ((PlayRecyclerView)findViewById(2131755930));
  this.mPageIndicator = ((ScalingPageIndicator)findViewById(2131755931));
  ViewCompat.setImportantForAccessibility(this.mPageIndicator, 2);
  getContext();
  LinearLayoutManager localLinearLayoutManager = new LinearLayoutManager(0);
  this.mTitleRecycler.setLayoutManager(localLinearLayoutManager);
  this.mTitleRecycler.setHasFixedSize(true);
  this.mTitleRecycler.setFocusable(false);
  ViewCompat.setAccessibilityDelegate(this.mTitleRecycler, new AccessibilityDelegateCompat()
  {
    public final void onInitializeAccessibilityEvent(View paramAnonymousView, AccessibilityEvent paramAnonymousAccessibilityEvent)
    {
      AccessibilityRecordCompat localAccessibilityRecordCompat = AccessibilityEventCompat.asRecord(paramAnonymousAccessibilityEvent);
      AccessibilityRecordCompat.IMPL.setContentDescription(localAccessibilityRecordCompat.mRecord, null);
    }
  });
  if (Build.VERSION.SDK_INT >= 14) {
    this.mTitleRecycler.addOnScrollListener(new RecyclerView.OnScrollListener()
    {
      @TargetApi(14)
      public final void onScrolled(RecyclerView paramAnonymousRecyclerView, int paramAnonymousInt1, int paramAnonymousInt2)
      {
        super.onScrolled(paramAnonymousRecyclerView, paramAnonymousInt1, paramAnonymousInt2);
        paramAnonymousRecyclerView.getLayoutManager();
        int i = PlayHighlightsOverlayView.this.mTitleRecycler.getWidth();
        int j = PlayHighlightsOverlayView.this.mTitleRecycler.getLeft() + i / 2;
        for (int k = 0; k < paramAnonymousRecyclerView.getChildCount(); k++)
        {
          View localView = paramAnonymousRecyclerView.getChildAt(k);
          float f = Math.abs(LinearLayoutManager.getDecoratedLeft(localView) + LinearLayoutManager.getDecoratedMeasuredWidth(localView) / 2 - j) / PlayHighlightsOverlayView.this.mItemWidth;
          localView.setAlpha(Math.max(0.0F, 1.0F - PlayHighlightsOverlayView.this.mAlphaInterpolator.getInterpolation(f)));
        }
      }
    });
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:40,代碼來源:PlayHighlightsOverlayView.java

示例4: getItemDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
AccessibilityDelegateCompat getItemDelegate() {
    return mItemDelegate;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:4,代碼來源:RecyclerViewAccessibilityDelegate.java

示例5: getItemDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
AccessibilityDelegateCompat getItemDelegate() {
    return this.mItemDelegate;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:RecyclerViewAccessibilityDelegate.java

示例6: getItemDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
@Override
public AccessibilityDelegateCompat getItemDelegate() {
    return mItemDelegate;
}
 
開發者ID:RikkaW,項目名稱:MaterialPreference,代碼行數:5,代碼來源:PreferenceRecyclerViewAccessibilityDelegate.java

示例7: getAccessibilityDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
public AccessibilityDelegateCompat getAccessibilityDelegate() {
    return mDelegate;
}
 
開發者ID:dgrigutsch,項目名稱:HoloDatePickerDialog,代碼行數:4,代碼來源:TouchExplorationHelper.java

示例8: getAccessibilityDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
public AccessibilityDelegateCompat getAccessibilityDelegate() {
  return mDelegate;
}
 
開發者ID:cdeange,項目名稱:uwaterloo-api,代碼行數:4,代碼來源:TouchExplorationHelper.java

示例9: getAccessibilityDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
public AccessibilityDelegateCompat getAccessibilityDelegate() {
	return mDelegate;
}
 
開發者ID:RedInput,項目名稱:DateTimePickerCompat,代碼行數:4,代碼來源:TouchExplorationHelper.java

示例10: getItemDelegate

import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
/**
 * Gets the AccessibilityDelegate for an individual item in the RecyclerView.
 * A basic item delegate is provided by default, but you can override this
 * method to provide a custom per-item delegate.
 */
public AccessibilityDelegateCompat getItemDelegate() {
    return mItemDelegate;
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:9,代碼來源:RecyclerViewAccessibilityDelegate.java


注:本文中的android.support.v4.view.AccessibilityDelegateCompat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。