本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.setSource方法的具体用法?Java AccessibilityEvent.setSource怎么用?Java AccessibilityEvent.setSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityEvent
的用法示例。
在下文中一共展示了AccessibilityEvent.setSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendAccessibilityEventForVirtualText
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
private void sendAccessibilityEventForVirtualText(int eventType) {
if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
mInputText.onInitializeAccessibilityEvent(event);
mInputText.onPopulateAccessibilityEvent(event);
event.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
requestSendAccessibilityEvent(NumberPicker.this, event);
}
}
示例2: sendAccessibilityEventForVirtualButton
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
private void sendAccessibilityEventForVirtualButton(int virtualViewId, int eventType,
String text) {
if (((AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setClassName(Button.class.getName());
event.setPackageName(getContext().getPackageName());
event.getText().add(text);
event.setEnabled(NumberPicker.this.isEnabled());
event.setSource(NumberPicker.this, virtualViewId);
requestSendAccessibilityEvent(NumberPicker.this, event);
}
}
示例3: onInitializeAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
if (VERSION.SDK_INT < 14) {
return;
}
if (event.getEventType() == 32) {
event.setSource(this);
event.setClassName(getClass().getName());
event.setPackageName(getContext().getPackageName());
event.setContentDescription(this.mTitle);
return;
}
super.onInitializeAccessibilityEvent(event);
}