本文整理匯總了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;
}
示例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);
}
}
});
}
示例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)));
}
}
});
}
}
示例4: getItemDelegate
import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
AccessibilityDelegateCompat getItemDelegate() {
return mItemDelegate;
}
示例5: getItemDelegate
import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
AccessibilityDelegateCompat getItemDelegate() {
return this.mItemDelegate;
}
示例6: getItemDelegate
import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
@Override
public AccessibilityDelegateCompat getItemDelegate() {
return mItemDelegate;
}
示例7: getAccessibilityDelegate
import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
public AccessibilityDelegateCompat getAccessibilityDelegate() {
return mDelegate;
}
示例8: getAccessibilityDelegate
import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
public AccessibilityDelegateCompat getAccessibilityDelegate() {
return mDelegate;
}
示例9: getAccessibilityDelegate
import android.support.v4.view.AccessibilityDelegateCompat; //導入依賴的package包/類
public AccessibilityDelegateCompat getAccessibilityDelegate() {
return mDelegate;
}
示例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;
}