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#isFocused()
The following examples show how to use
android.view.View#isFocused() .
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: InputLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateHint(View child) { if (labelTextView == null) return; if (child == null) { labelTextView.setVisibility(GONE); return; } if (labelMode == LabelMode.Persistent || labelMode == LabelMode.Floating && child.isFocused() || labelMode == LabelMode.IfNotEmpty && (child.isFocused() || child instanceof android.widget.TextView && ((android.widget.TextView) child).getText().length() > 0)) { labelTextView.animateVisibility(VISIBLE); if (child instanceof EditText) ((EditText) child).setHint(null); } else if (labelMode != LabelMode.Hint) { labelTextView.animateVisibility(INVISIBLE); if (child instanceof EditText) ((EditText) child).setHint(label + (((EditText) child).isRequired() ? " *" : "")); } else { labelTextView.setVisibility(GONE); } }
Example 2
Source File: MainActivity.java From android-tv-launcher with MIT License | 6 votes |
/** * 顶部焦点获取 * * @param keyCode * @param event * @return */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean focusFlag = false; for (View v : mViews) { if (v.isFocused()) { focusFlag = true; } } Log.d(TAG, "code:" + keyCode + " flag:" + focusFlag); if (focusFlag) { if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode) { if (mCurrentIndex > 0) { mViews[--mCurrentIndex].requestFocus(); } return true; } else if (KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) { if (mCurrentIndex < 2) { mViews[++mCurrentIndex].requestFocus(); } return true; } } return super.onKeyDown(keyCode, event); }
Example 3
Source File: ViewUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 获取是否当前 View 就是焦点 View * @param view {@link View} * @return {@code true} yes, {@code false} no */ public static boolean isFocused(final View view) { if (view != null) { return view.isFocused(); } return false; }
Example 4
Source File: DocumentView.java From ViewPrinter with Apache License 2.0 | 5 votes |
@Override public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { if (view.isFocused() && view instanceof TextView) { // A focused view changed its bounds. Follow it? int height = bottom - top; int oldHeight = oldBottom - oldTop; if (oldHeight != height) { zoomToView(view, false); } } else { view.removeOnLayoutChangeListener(this); } }
Example 5
Source File: LabelLayout.java From revolution-irc with GNU General Public License v3.0 | 5 votes |
private static boolean hasFocusedChild(View view) { if (view.isFocused()) return true; if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; for (int i = 0; i < group.getChildCount(); i++) { if (hasFocusedChild(group.getChildAt(i))) return true; } } return false; }
Example 6
Source File: ActivityServiceUtils.java From HgLauncher with GNU General Public License v3.0 | 5 votes |
/** * Show the software keyboard and request focus to a certain input field. * * @param activity The activity hosting the view to be in focus. * @param view The view requesting focus. */ public static void showSoftKeyboard(Activity activity, View view) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService( Activity.INPUT_METHOD_SERVICE); if (!view.isFocused()) { view.requestFocus(); } if (inputMethodManager != null) { inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } }
Example 7
Source File: ActivityServiceUtils.java From HgLauncher with GNU General Public License v3.0 | 5 votes |
/** * Show the software keyboard and request focus to a certain input field. * * @param activity The activity hosting the view to be in focus. * @param view The view requesting focus. */ public static void showSoftKeyboard(Activity activity, View view) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService( Activity.INPUT_METHOD_SERVICE); if (!view.isFocused()) { view.requestFocus(); } if (inputMethodManager != null) { inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } }
Example 8
Source File: RecyclerView.java From kripton with Apache License 2.0 | 5 votes |
private int getDeepestFocusedViewWithId(View view) { int lastKnownId = view.getId(); while (!view.isFocused() && view instanceof ViewGroup && view.hasFocus()) { view = ((ViewGroup) view).getFocusedChild(); final int id = view.getId(); if (id != View.NO_ID) { lastKnownId = view.getId(); } } return lastKnownId; }
Example 9
Source File: AndroidTester.java From aedict with GNU General Public License v3.0 | 5 votes |
/** * Sets focus on given view. * * @param view * the view to focus. */ public void focus(final View view) { if (view.isFocused()) { return; } if (!view.isFocusable()) { throw new AssertionError("The view " + view.getId() + " is not focusable"); } if (!view.requestFocus()) { throw new AssertionError("The view " + view.getId() + " did not took the focus"); } }
Example 10
Source File: NestedScrollView.java From letv with Apache License 2.0 | 4 votes |
public boolean arrowScroll(int direction) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null; } View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); int maxJump = getMaxScrollAmount(); if (nextFocused == null || !isWithinDeltaOfScreen(nextFocused, maxJump, getHeight())) { int scrollDelta = maxJump; if (direction == 33 && getScrollY() < scrollDelta) { scrollDelta = getScrollY(); } else if (direction == 130 && getChildCount() > 0) { int daBottom = getChildAt(0).getBottom(); int screenBottom = (getScrollY() + getHeight()) - getPaddingBottom(); if (daBottom - screenBottom < maxJump) { scrollDelta = daBottom - screenBottom; } } if (scrollDelta == 0) { return false; } int i; if (direction == 130) { i = scrollDelta; } else { i = -scrollDelta; } doScrollY(i); } else { nextFocused.getDrawingRect(this.mTempRect); offsetDescendantRectToMyCoords(nextFocused, this.mTempRect); doScrollY(computeScrollDeltaToGetChildRectOnScreen(this.mTempRect)); nextFocused.requestFocus(direction); } if (currentFocused != null && currentFocused.isFocused() && isOffScreen(currentFocused)) { int descendantFocusability = getDescendantFocusability(); setDescendantFocusability(131072); requestFocus(); setDescendantFocusability(descendantFocusability); } return true; }
Example 11
Source File: ViewMatchers.java From android-test with Apache License 2.0 | 4 votes |
@Override public boolean matchesSafely(View view) { return view.isFocused() == isFocused; }