Available Methods
- findViewById ( )
- getId ( )
- getLayoutParams ( )
- getTag ( )
- setTag ( )
- VISIBLE
- setVisibility ( )
- setOnClickListener ( )
- OnClickListener ( )
- getLeft ( )
- getHeight ( )
- getWidth ( )
- getTop ( )
- getVisibility ( )
- GONE
- setLayoutParams ( )
- getMeasuredHeight ( )
- inflate ( )
- getBottom ( )
- getMeasuredWidth ( )
- setBackgroundColor ( )
- getRight ( )
- measure ( )
- getParent ( )
- layout ( )
- getContext ( )
- setAlpha ( )
- setTranslationX ( )
- startAnimation ( )
- setScaleX ( )
- setScaleY ( )
- setPadding ( )
- setBackgroundResource ( )
- requestFocus ( )
- getLocationOnScreen ( )
- setTranslationY ( )
- setDrawingCacheEnabled ( )
- setPivotY ( )
- setOnLongClickListener ( )
- setPivotX ( )
- setBackground ( )
- INVISIBLE
- draw ( )
- setSystemUiVisibility ( )
- setBackgroundDrawable ( )
- equals ( )
- NO_ID
- getScrollY ( )
- OnLongClickListener ( )
- getBackground ( )
- postDelayed ( )
- setEnabled ( )
- setSelected ( )
- getY ( )
- requestLayout ( )
- getScrollX ( )
- setClickable ( )
- post ( )
- getDrawingCache ( )
- getTranslationY ( )
- setOnTouchListener ( )
- SYSTEM_UI_FLAG_FULLSCREEN
- destroyDrawingCache ( )
- SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- OnTouchListener ( )
- setRotation ( )
- getHitRect ( )
- getPaddingRight ( )
- setRotationY ( )
- invalidate ( )
- getPaddingBottom ( )
- buildDrawingCache ( )
- SYSTEM_UI_FLAG_HIDE_NAVIGATION
- LAYOUT_DIRECTION_RTL
- setId ( )
- setPressed ( )
- getLocationInWindow ( )
- clearAnimation ( )
- SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- SYSTEM_UI_FLAG_LAYOUT_STABLE
- getPaddingLeft ( )
- getX ( )
- getTranslationX ( )
- getDrawingRect ( )
- FOCUS_UP
- getPaddingTop ( )
- SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- setLayerType ( )
- getGlobalVisibleRect ( )
- setFocusable ( )
- setRotationX ( )
- FOCUS_RIGHT
- clearFocus ( )
- getViewTreeObserver ( )
- SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
- canScrollVertically ( )
- getRootView ( )
- dispatchPopulateAccessibilityEvent ( )
- postOnAnimation ( )
- isShown ( )
- setY ( )
- FOCUS_LEFT
- getSystemUiVisibility ( )
- offsetLeftAndRight ( )
- getWindowVisibleDisplayFrame ( )
- getResources ( )
- getScaleX ( )
- addTouchables ( )
- bringToFront ( )
- isEnabled ( )
- performClick ( )
- FOCUS_DOWN
- FOCUS_BACKWARD
- setX ( )
- setFitsSystemWindows ( )
- FOCUS_FORWARD
- SYSTEM_UI_FLAG_LOW_PROFILE
- getWindowToken ( )
- setAnimation ( )
- offsetTopAndBottom ( )
- setFocusableInTouchMode ( )
- generateViewId ( )
- isSelected ( )
- sendAccessibilityEvent ( )
- setOnCreateContextMenuListener ( )
- removeCallbacks ( )
- scrollTo ( )
- setMinimumWidth ( )
- isClickable ( )
- getLayerType ( )
- getAlpha ( )
- setOnSystemUiVisibilityChangeListener ( )
- addFocusables ( )
- isFocusable ( )
- getClass ( )
- setDrawingCacheBackgroundColor ( )
- dispatchTouchEvent ( )
- setActivated ( )
- SYSTEM_UI_FLAG_IMMERSIVE
- LAYER_TYPE_HARDWARE
- hashCode ( )
- setElevation ( )
- addOnLayoutChangeListener ( )
- setAccessibilityDelegate ( )
- OnFocusChangeListener ( )
- LAYER_TYPE_NONE
- isLayoutRequested ( )
- setCameraDistance ( )
- isPressed ( )
- getAnimation ( )
- getScaleY ( )
- getRotationY ( )
- setMinimumHeight ( )
- animate ( )
- getOverScrollMode ( )
- getRotationX ( )
- onTouchEvent ( )
- setContentDescription ( )
- getRotation ( )
- SYSTEM_UI_FLAG_VISIBLE
- setLongClickable ( )
- canScrollHorizontally ( )
- performHapticFeedback ( )
- hasFocus ( )
- removeOnAttachStateChangeListener ( )
- cancelLongPress ( )
- LAYOUT_DIRECTION_LTR
- OVER_SCROLL_NEVER
- isInEditMode ( )
- getLayoutDirection ( )
- playSoundEffect ( )
- getDrawingCacheBackgroundColor ( )
- setOutlineProvider ( )
- getDefaultSize ( )
- isAttachedToWindow ( )
- SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
- setOnKeyListener ( )
- setWillNotCacheDrawing ( )
- hasTransientState ( )
- getLocalVisibleRect ( )
- startDrag ( )
- getPivotY ( )
- willNotCacheDrawing ( )
- LAYER_TYPE_SOFTWARE
- saveHierarchyState ( )
- findViewWithTag ( )
- performLongClick ( )
- requestFocusFromTouch ( )
- setOnApplyWindowInsetsListener ( )
- postInvalidateOnAnimation ( )
- isLongClickable ( )
- setTranslationZ ( )
- setOnFocusChangeListener ( )
- hasFocusable ( )
- setTop ( )
- addOnAttachStateChangeListener ( )
- postInvalidate ( )
- postInvalidateDelayed ( )
- onStartTemporaryDetach ( )
- removeOnLayoutChangeListener ( )
- getAccessibilityViewId ( )
- restoreHierarchyState ( )
- isHardwareAccelerated ( )
- setHasTransientState ( )
- getImportantForAccessibility ( )
- setBottom ( )
- setLeft ( )
- DragShadowBuilder ( )
- getBaseline ( )
- SCROLL_AXIS_VERTICAL
- setScrollX ( )
- isFocusableInTouchMode ( )
- forceLayout ( )
- setPaddingRelative ( )
- SCROLLBAR_POSITION_RIGHT
- setImportantForAccessibility ( )
- getPivotX ( )
- getContentDescription ( )
- announceForAccessibility ( )
- isDrawingCacheEnabled ( )
- showContextMenu ( )
- setDrawingCacheQuality ( )
- setRight ( )
- OnKeyListener ( )
- getFitsSystemWindows ( )
- OnLayoutChangeListener ( )
- getTransitionName ( )
- addView ( )
- dispatchApplyWindowInsets ( )
- onCheckIsTextEditor ( )
- setLayoutDirection ( )
- onFinishTemporaryDetach ( )
- setTransitionName ( )
- isFocused ( )
- getRootWindowInsets ( )
- jumpDrawablesToCurrentState ( )
- setClipToOutline ( )
- getWindowVisibility ( )
- getFocusedRect ( )
- IMPORTANT_FOR_ACCESSIBILITY_AUTO
- setScrollY ( )
- isActivated ( )
- STATUS_BAR_HIDDEN
- setOverScrollMode ( )
- setLabelFor ( )
- getMatrix ( )
- setHorizontalScrollBarEnabled ( )
- isOpaque ( )
- getParentForAccessibility ( )
- setLayerPaint ( )
- startDragAndDrop ( )
- setStateListAnimator ( )
- postOnAnimationDelayed ( )
- getPaddingStart ( )
- hasWindowFocus ( )
- getMinimumHeight ( )
- resolveSize ( )
- findFocus ( )
- AUTOFILL_TYPE_DATE
- setKeepScreenOn ( )
- focusSearch ( )
- getPaddingEnd ( )
- onInitializeAccessibilityNodeInfo ( )
- getViewRootImpl ( )
- isInTouchMode ( )
- getKeyDispatcherState ( )
- isLaidOut ( )
- scrollBy ( )
- AUTOFILL_TYPE_TEXT
- getTranslationZ ( )
- getWindowSystemUiVisibility ( )
- OVER_SCROLL_ALWAYS
- getMeasuredWidthAndState ( )
- performAccessibilityAction ( )
- AccessibilityDelegate ( )
- STATUS_BAR_TRANSLUCENT
- callOnClick ( )
- getAccessibilityLiveRegion ( )
- resolveSizeAndState ( )
- isImportantForAccessibility ( )
- getLabelFor ( )
- OnAttachStateChangeListener ( )
- getMeasuredHeightAndState ( )
- TEXT_ALIGNMENT_GRAVITY
- drawableHotspotChanged ( )
- getAccessibilityNodeProvider ( )
- onInitializeAccessibilityEvent ( )
- getZ ( )
- refreshDrawableState ( )
- IMPORTANT_FOR_ACCESSIBILITY_YES
- AUTOFILL_HINT_USERNAME
- setTagInternal ( )
- getHandler ( )
- getOnFocusChangeListener ( )
- isScrollContainer ( )
- getNextFocusRightId ( )
- IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
- getWindowId ( )
- TEXT_ALIGNMENT_VIEW_START
- onPopulateAccessibilityEvent ( )
- TRANSLATION_Y
- setWillNotDraw ( )
- setTextAlignment ( )
Related Classes
- java.io.File
- android.os.Bundle
- android.content.Context
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.app.Activity
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.widget.ImageView
- android.graphics.Color
- android.os.Handler
- android.net.Uri
- android.widget.Button
- android.graphics.Bitmap
- android.text.TextUtils
- android.view.MotionEvent
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
- android.support.annotation.Nullable
- android.widget.EditText
- android.content.SharedPreferences
- android.support.annotation.NonNull
Java Code Examples for android.view.View#focusSearch()
The following examples show how to use
android.view.View#focusSearch() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TvGridLayout.java From base-module with Apache License 2.0 | 6 votes |
private boolean checkIfOnBorder(int direction, int[] twoPage) { if (direction == FOCUS_LEFT || direction == FOCUS_RIGHT) { View view = getFocusedChild(); View childView = findChildView(view); if (childView != null) { int curPage = ((LayoutParams) childView.getLayoutParams()).pageIndex; twoPage[0] = twoPage[1] = curPage; View nextFocusView = view.focusSearch(direction); View nextChildView = findChildView(nextFocusView); if (nextChildView == null) { return true; } int nextPage = ((LayoutParams) nextChildView.getLayoutParams()).pageIndex; twoPage[1] = nextPage; return curPage != nextPage; } } return false; }
Example 2
Source File: MnemonicActivity.java From green_android with GNU General Public License v3.0 | 5 votes |
private void nextFocus() { final View view = getCurrentFocus(); if (!(view instanceof TextView)) return; final View next = view.focusSearch(View.FOCUS_FORWARD); if (next != null) next.requestFocus(); }
Example 3
Source File: SimpleMonthView.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // We need to handle focus change within the SimpleMonthView because we are simulating // multiple Views. The arrow keys will move between days until there is no space (no // day to the left, top, right, or bottom). Focus forward and back jumps out of the // SimpleMonthView, skipping over other SimpleMonthViews in the parent ViewPager // to the next focusable View in the hierarchy. boolean focusChanged = false; switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_LEFT: if (event.hasNoModifiers()) { focusChanged = moveOneDay(isLayoutRtl()); } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (event.hasNoModifiers()) { focusChanged = moveOneDay(!isLayoutRtl()); } break; case KeyEvent.KEYCODE_DPAD_UP: if (event.hasNoModifiers()) { ensureFocusedDay(); if (mHighlightedDay > 7) { mHighlightedDay -= 7; focusChanged = true; } } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (event.hasNoModifiers()) { ensureFocusedDay(); if (mHighlightedDay <= mDaysInMonth - 7) { mHighlightedDay += 7; focusChanged = true; } } break; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: if (mHighlightedDay != -1) { onDayClicked(mHighlightedDay); return true; } break; case KeyEvent.KEYCODE_TAB: { int focusChangeDirection = 0; if (event.hasNoModifiers()) { focusChangeDirection = View.FOCUS_FORWARD; } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) { focusChangeDirection = View.FOCUS_BACKWARD; } if (focusChangeDirection != 0) { final ViewParent parent = getParent(); // move out of the ViewPager next/previous View nextFocus = this; do { nextFocus = nextFocus.focusSearch(focusChangeDirection); } while (nextFocus != null && nextFocus != this && nextFocus.getParent() == parent); if (nextFocus != null) { nextFocus.requestFocus(); return true; } } break; } } if (focusChanged) { invalidate(); return true; } else { return super.onKeyDown(keyCode, event); } }
Example 4
Source File: FieldLayout.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void nextFocus(View view) { View nextView; if ((nextView = view.focusSearch(FOCUS_DOWN)) != null) nextView.requestFocus(); }
Example 5
Source File: SimpleMonthView.java From DateTimePicker with Apache License 2.0 | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // We need to handle focus change within the SimpleMonthView because we are simulating // multiple Views. The arrow keys will move between days until there is no space (no // day to the left, top, right, or bottom). Focus forward and back jumps out of the // SimpleMonthView, skipping over other SimpleMonthViews in the parent ViewPager // to the next focusable View in the hierarchy. boolean focusChanged = false; switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_LEFT: if (event.hasNoModifiers()) { focusChanged = moveOneDay(isLayoutRtl()); } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (event.hasNoModifiers()) { focusChanged = moveOneDay(!isLayoutRtl()); } break; case KeyEvent.KEYCODE_DPAD_UP: if (event.hasNoModifiers()) { ensureFocusedDay(); if (mHighlightedDay > 7) { mHighlightedDay -= 7; focusChanged = true; } } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (event.hasNoModifiers()) { ensureFocusedDay(); if (mHighlightedDay <= mDaysInMonth - 7) { mHighlightedDay += 7; focusChanged = true; } } break; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: if (mHighlightedDay != -1) { onDayClicked(mHighlightedDay); return true; } break; case KeyEvent.KEYCODE_TAB: { int focusChangeDirection = 0; if (event.hasNoModifiers()) { focusChangeDirection = View.FOCUS_FORWARD; } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) { focusChangeDirection = View.FOCUS_BACKWARD; } if (focusChangeDirection != 0) { final ViewParent parent = getParent(); // move out of the ViewPager next/previous View nextFocus = this; do { nextFocus = nextFocus.focusSearch(focusChangeDirection); } while (nextFocus != null && nextFocus != this && nextFocus.getParent() == parent); if (nextFocus != null) { nextFocus.requestFocus(); return true; } } break; } } if (focusChanged) { invalidate(); return true; } else { return super.onKeyDown(keyCode, event); } }
Example 6
Source File: MetroLayout.java From android_tv_metro with Apache License 2.0 | 4 votes |
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Handle automatic focus changes. if (event.getAction() == KeyEvent.ACTION_DOWN) { int direction = 0; switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_LEFT: if (event.hasNoModifiers()) { direction = View.FOCUS_LEFT; } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (event.hasNoModifiers()) { direction = View.FOCUS_RIGHT; } break; case KeyEvent.KEYCODE_DPAD_UP: if (event.hasNoModifiers()) { direction = View.FOCUS_UP; } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (event.hasNoModifiers()) { direction = View.FOCUS_DOWN; } break; case KeyEvent.KEYCODE_TAB: if (event.hasNoModifiers()) { direction = View.FOCUS_FORWARD; } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) { direction = View.FOCUS_BACKWARD; } break; } if (direction == View.FOCUS_DOWN || direction == View.FOCUS_UP) { View focused = findFocus(); if (focused != null) { View v = focused.focusSearch(direction); if (v == null) { Utils.playKeySound(this, Utils.SOUND_ERROR_KEY); mMetroCursorView.showIndicator(); } } } } boolean ret = super.dispatchKeyEvent(event); return ret; }