本文整理匯總了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));
}