本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.setContentDescription方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.setContentDescription方法的具体用法?Java AccessibilityEvent.setContentDescription怎么用?Java AccessibilityEvent.setContentDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityEvent
的用法示例。
在下文中一共展示了AccessibilityEvent.setContentDescription方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPopulateEventForVirtualView
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
protected void onPopulateEventForVirtualView(int id, AccessibilityEvent event) {
if (id == INVALID_ID) {
throw new IllegalArgumentException("Invalid virtual view id");
}
event.setContentDescription(mContext.getString(R.string.action_move_here));
}
示例2: onInitializeAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
// Action mode started
//TODO event.setSource(this);
event.setClassName(getClass().getName());
event.setPackageName(getContext().getPackageName());
event.setContentDescription(mTitle);
} else {
//TODO super.onInitializeAccessibilityEvent(event);
}
}
示例3: onPopulateEventForVirtualView
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
protected void onPopulateEventForVirtualView(int virtualViewId, AccessibilityEvent event) {
if (mVirtualViews == null || mVirtualViews.size() <= virtualViewId) {
// TODO(clholgat): Remove this work around when the Android bug is fixed.
// crbug.com/420177
event.setContentDescription(PLACE_HOLDER_STRING);
return;
}
VirtualView view = mVirtualViews.get(virtualViewId);
event.setContentDescription(view.getAccessibilityDescription());
event.setClassName(CompositorViewHolder.class.getName());
}
示例4: 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);
}
示例5: createAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* Creates and populates an {@link AccessibilityEvent} for the specified key
* and event type.
*
* @param key A key on the host keyboard view.
* @param eventType The event type to create.
* @return A populated {@link AccessibilityEvent} for the key.
* @see AccessibilityEvent
*/
public AccessibilityEvent createAccessibilityEvent(final Key key, final int eventType) {
final int virtualViewId = getVirtualViewIdOf(key);
final String keyDescription = getKeyDescription(key);
final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setPackageName(mKeyboardView.getContext().getPackageName());
event.setClassName(key.getClass().getName());
event.setContentDescription(keyDescription);
event.setEnabled(true);
final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
record.setSource(mKeyboardView, virtualViewId);
return event;
}
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:22,代码来源:KeyboardAccessibilityNodeProvider.java
示例6: sendWindowStateChanged
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* Sends a window state change event with the specified text.
*
* @param text The text to send with the event.
*/
protected void sendWindowStateChanged(final String text) {
final AccessibilityEvent stateChange = AccessibilityEvent.obtain(
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
mKeyboardView.onInitializeAccessibilityEvent(stateChange);
stateChange.getText().add(text);
stateChange.setContentDescription(null);
final ViewParent parent = mKeyboardView.getParent();
if (parent != null) {
parent.requestSendAccessibilityEvent(mKeyboardView, stateChange);
}
}
示例7: onPopulateEventForVirtualView
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
protected void onPopulateEventForVirtualView(int virtualViewId, AccessibilityEvent event) {
event.setClassName(getClass().getName());
final int type = getTypeFromId(virtualViewId);
final int value = getValueFromId(virtualViewId);
final CharSequence description = getVirtualViewDescription(type, value);
event.setContentDescription(description);
}
示例8: onPopulateEventForVirtualView
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
protected void onPopulateEventForVirtualView(int virtualViewId, AccessibilityEvent event) {
event.setContentDescription(getItemDescription(virtualViewId));
}
示例9: onPopulateEventForVirtualView
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
protected void onPopulateEventForVirtualView(int virtualViewId, AccessibilityEvent event) {
event.setContentDescription(getItemDescription(virtualViewId));
}
示例10: onPopulateEventForVirtualView
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
protected void onPopulateEventForVirtualView(int virtualViewId, AccessibilityEvent event) {
event.setContentDescription(getDayDescription(virtualViewId));
}