当前位置: 首页>>代码示例>>Java>>正文


Java View.isShown方法代码示例

本文整理汇总了Java中android.view.View.isShown方法的典型用法代码示例。如果您正苦于以下问题:Java View.isShown方法的具体用法?Java View.isShown怎么用?Java View.isShown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.isShown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVisiblePercent

import android.view.View; //导入方法依赖的package包/类
public int getVisiblePercent(View v) {

        Rect scrollBounds = new Rect();
        scrollView.getHitRect(scrollBounds);
        if (v.getLocalVisibleRect(scrollBounds)) {
            // Any portion of the imageView, even a single pixel, is within the visible window
        } else {
            // NONE of the imageView is within the visible window
            return -1;
        }

        if (v.isShown()) {
            Rect r = new Rect();
            v.getGlobalVisibleRect(r);
            double sVisible = r.width() * r.height();
            double sTotal = v.getWidth() * v.getHeight();

            MyLg.e(TAG, "sVisible " + sVisible + " sTotal" + sTotal);

            return (int) (100 * sVisible / sTotal) - 20;
        } else {
            return -1;
        }
    }
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:25,代码来源:PlaceDetailActivity.java

示例2: updateStickyHeaderPosition

import android.view.View; //导入方法依赖的package包/类
private void updateStickyHeaderPosition() {
    // Note: for pre-Honeycomb the header will not be moved, so this ScrollView essentially
    // behaves like a normal BottomScrollView.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        if (mSticky != null) {
            // The view to draw when sticking to the top
            final View drawTarget = mStickyContainer != null ? mStickyContainer : mSticky;
            // The offset to draw the view at when sticky
            final int drawOffset = mStickyContainer != null ? mSticky.getTop() : 0;
            // Position of the draw target, relative to the outside of the scrollView
            final int drawTop = drawTarget.getTop() - getScrollY();
            if (drawTop + drawOffset < mStatusBarInset || !drawTarget.isShown()) {
                // ScrollView translates the whole canvas so we have to compensate for that
                drawTarget.setTranslationY(getScrollY() - drawOffset);
            } else {
                drawTarget.setTranslationY(0);
            }
        }
    }
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:21,代码来源:StickyHeaderScrollView.java

示例3: takeFocus

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean takeFocus(boolean reverse) {
    Activity activity = mTab.getActivity();
    if (activity == null) return false;
    if (reverse) {
        View menuButton = activity.findViewById(R.id.menu_button);
        if (menuButton == null || !menuButton.isShown()) {
            menuButton = activity.findViewById(R.id.document_menu_button);
        }
        if (menuButton != null && menuButton.isShown()) {
            return menuButton.requestFocus();
        }

        View tabSwitcherButton = activity.findViewById(R.id.tab_switcher_button);
        if (tabSwitcherButton != null && tabSwitcherButton.isShown()) {
            return tabSwitcherButton.requestFocus();
        }
    } else {
        View urlBar = activity.findViewById(R.id.url_bar);
        if (urlBar != null) return urlBar.requestFocus();
    }
    return false;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:TabWebContentsDelegateAndroid.java

示例4: canDragView

import android.view.View; //导入方法依赖的package包/类
@Override
boolean canDragView(AppBarLayout view) {
  if (mOnDragCallback != null) {
    // If there is a drag callback set, it's in control
    return mOnDragCallback.canDrag(view);
  }

  // Else we'll use the default behaviour of seeing if it can scroll down
  if (mLastNestedScrollingChildRef != null) {
    // If we have a reference to a scrolling view, check it
    final View scrollingView = mLastNestedScrollingChildRef.get();
            return scrollingView != null && scrollingView.isShown()
                    && !scrollingView.canScrollVertically(-1);
  } else {
    // Otherwise we assume that the scrolling view hasn't been scrolled and can drag.
    return true;
  }
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:19,代码来源:AppBarLayout.java

示例5: draw

import android.view.View; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    if (mSticky != null) {
        final int saveCount = canvas.save();
        // The view to draw when sticking to the top
        final View drawTarget = mStickyContainer != null ? mStickyContainer : mSticky;
        // The offset to draw the view at when sticky
        final int drawOffset = mStickyContainer != null ? mSticky.getTop() : 0;
        // Position of the draw target, relative to the outside of the scrollView
        final int drawTop = drawTarget.getTop();
        if (drawTop + drawOffset < mStatusBarInset || !drawTarget.isShown()) {
            // ListView does not translate the canvas, so we can simply draw at the top
            mStickyRect.set(0, -drawOffset + mStatusBarInset, drawTarget.getWidth(),
                    drawTarget.getHeight() - drawOffset + mStatusBarInset);
            canvas.translate(0, mStickyRect.top);
            canvas.clipRect(0, 0, drawTarget.getWidth(), drawTarget.getHeight());
            drawTarget.draw(canvas);
        } else {
            mStickyRect.setEmpty();
        }
        canvas.restoreToCount(saveCount);
    }
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:25,代码来源:StickyHeaderListView.java

示例6: inRangeOfView

import android.view.View; //导入方法依赖的package包/类
public boolean inRangeOfView(View view, MotionEvent ev) {
    int[] location = new int[2];
    if (view==null||!view.isShown()){
        return false;
    }
    view.getLocationOnScreen(location);
    int x = location[0];
    int y = location[1];
    if (ev.getRawX() < x
            || ev.getRawX() > (x + view.getWidth())
            || ev.getRawY() < y
            || ev.getRawY() > (y + view.getHeight())) {
        return false;
    }
    return true;
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:17,代码来源:SimpleClickListener.java

示例7: findViewAt

import android.view.View; //导入方法依赖的package包/类
@Nullable
private View findViewAt(@NonNull final View view, final float x, final float y) {
    if (!view.isShown() || !view.isEnabled() || !isViewAt(view, x, y)) {
        return null;
    }

    if (view instanceof ViewGroup) {
        final float transformedX = x - view.getLeft() - ViewCompat.getTranslationX(view);
        final float transformedY = y - view.getTop() - ViewCompat.getTranslationY(view);

        final ViewGroup viewGroup = (ViewGroup) view;
        final int childCount = viewGroup.getChildCount();
        for (int i = childCount - 1; i >= 0; i--) {
            final View child = viewGroup.getChildAt(i);
            final View foundView = findViewAt(child, transformedX, transformedY);
            if (foundView != null) {
                return foundView;
            }
        }
    }

    return view;
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:24,代码来源:ClickableViewFinder.java

示例8: scrollToBar

import android.view.View; //导入方法依赖的package包/类
private void scrollToBar(int barIndex, int autoScrollAnimationTime) {
    ViewParent parentView = getParent();
    if (parentView instanceof ScrollView) {
        final ScrollView parentScrollView = (ScrollView) parentView;
        for (View view : views) {
            if (view instanceof SystemView
                    && view.isShown()) {
                SystemView systemView = (SystemView) view;
                if (systemView.containsBar(barIndex)) {
                    int scroll_max = getBottom() - parentScrollView.getHeight();
                    int scroll_min = 0;
                    float windowHeight = parentScrollView.getHeight();
                    float windowPlayingCentre = kWindowPlayingCentreFractionFromTop * windowHeight;
                    float sysFrac = systemView.fractionalScroll(barIndex);
                    float playingCentre = view.getTop() + view.getHeight() * sysFrac;
                    float scroll_y = playingCentre - windowPlayingCentre;

                    if (scroll_y < scroll_min)
                        scroll_y = scroll_min;
                    else if (scroll_y > scroll_max)
                        scroll_y = scroll_max;
                    slowSmoothScrollTo(parentScrollView, (int) scroll_y, autoScrollAnimationTime);
                }
            }
        }
    }
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:28,代码来源:SeeScoreView.java

示例9: onGlobalLayout

import android.view.View; //导入方法依赖的package包/类
public void onGlobalLayout() {
    if (isShowing()) {
        View anchor = this.mAnchorView;
        if (anchor == null || !anchor.isShown()) {
            dismiss();
        } else if (isShowing()) {
            this.mPopup.show();
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:MenuPopupHelper.java

示例10: setCursorAtBar

import android.view.View; //导入方法依赖的package包/类
/**
 * set the vertical line cursor at a given bar with a given xpos (from the system left)
 * @param barIndex the (0-based) bar index
 * @param xpos the x coordinate from the system left
 * @param autoScrollAnimationTime a hint for the scroll time in ms
 * @return true if it succeeded
 */
public boolean setCursorAtBar(int barIndex, float xpos, int autoScrollAnimationTime) {
    boolean rval = false;
    for (View view : views) {
        if (view instanceof SystemView
                && view.isShown()) {
            SystemView systemView = (SystemView) view;
            if (systemView.setCursorAtBar(barIndex, xpos)) {
                scrollToBar(barIndex, autoScrollAnimationTime);
            }
        }
    }
    return rval;
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:21,代码来源:SeeScoreView.java

示例11: zooming

import android.view.View; //导入方法依赖的package包/类
/**
 * called during active pinching. Do quick rescale of display without relayout
 * Relayout happens on completion of gesture
 * 
 * @param zoom the current magnification based on the finger spacing compared
 * to the spacing at the start of the pinch
 */
private void zooming(final float zoom)
{
	float mag;
	if (magnification < kMinMag)
		magnification = kMinMag; // ensure no div-by-zero
	if (zoom * magnification < kMinMag)
		mag = kMinMag / magnification;
	else if (zoom * magnification > kMaxMag)
		mag = kMaxMag / magnification;
	else if (Math.abs(zoom * magnification - 1.0) < 0.05) // make easy to set 1.0
		mag = 1.0F / magnification;
	else
		mag = zoom;
	
	for (View view : views)
	{
		if (view instanceof SystemView
			&& view.isShown())
		{
			Rect r = new Rect();
			boolean vis = view.getGlobalVisibleRect (r);
			if (vis)
			{
				SystemView sv = (SystemView)view;
				sv.zooming(mag);
			}
		}
	}
	zoomNotify.zoom(zoom * magnification);
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:38,代码来源:SeeScoreView.java

示例12: colourItem

import android.view.View; //导入方法依赖的package包/类
void colourItem(int partIndex, int barIndex, int item_h, RenderItem.Colour col)
{
	for (View view : views) {
		if (view instanceof SystemView
			&& view.isShown()) {
			SystemView systemView = (SystemView) view;
			if (systemView.containsBar(barIndex))
			{
				systemView.colourItem(partIndex, barIndex, item_h, col);
				return;
			}
		}
	}
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:15,代码来源:SeeScoreView.java

示例13: clearAllColouring

import android.view.View; //导入方法依赖的package包/类
public void clearAllColouring()
{
	for (View view : views) {
		if (view instanceof SystemView
				&& view.isShown()) {
			SystemView systemView = (SystemView) view;
			systemView.clearAllColouring();
		}
	}
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:11,代码来源:SeeScoreView.java

示例14: canDragView

import android.view.View; //导入方法依赖的package包/类
boolean canDragView(AppBarLayout view) {
    if (this.mOnDragCallback != null) {
        return this.mOnDragCallback.canDrag(view);
    }
    if (this.mLastNestedScrollingChildRef == null) {
        return true;
    }
    View scrollingView = (View) this.mLastNestedScrollingChildRef.get();
    if (scrollingView == null || !scrollingView.isShown() || ViewCompat.canScrollVertically(scrollingView, -1)) {
        return false;
    }
    return true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:AppBarLayout.java

示例15: onComputeInsets

import android.view.View; //导入方法依赖的package包/类
@Override
public void onComputeInsets(final InputMethodService.Insets outInsets) {
    super.onComputeInsets(outInsets);
    // This method may be called before {@link #setInputView(View)}.
    if (mInputView == null) {
        return;
    }
    final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
    if (visibleKeyboardView == null) {
        return;
    }
    final int inputHeight = mInputView.getHeight();
    if (isImeSuppressedByHardwareKeyboard() && !visibleKeyboardView.isShown()) {
        // If there is a hardware keyboard and a visible software keyboard view has been hidden,
        // no visual element will be shown on the screen.
        outInsets.contentTopInsets = inputHeight;
        outInsets.visibleTopInsets = inputHeight;
        mInsetsUpdater.setInsets(outInsets);
        return;
    }
    final int visibleTopY = inputHeight - visibleKeyboardView.getHeight();
    // Need to set expanded touchable region only if a keyboard view is being shown.
    if (visibleKeyboardView.isShown()) {
        final int touchLeft = 0;
        final int touchTop = mKeyboardSwitcher.isShowingMoreKeysPanel() ? 0 : visibleTopY;
        final int touchRight = visibleKeyboardView.getWidth();
        final int touchBottom = inputHeight
                // Extend touchable region below the keyboard.
                + EXTENDED_TOUCHABLE_REGION_HEIGHT;
        outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
        outInsets.touchableRegion.set(touchLeft, touchTop, touchRight, touchBottom);
    }
    outInsets.contentTopInsets = visibleTopY;
    outInsets.visibleTopInsets = visibleTopY;
    mInsetsUpdater.setInsets(outInsets);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:37,代码来源:LatinIME.java


注:本文中的android.view.View.isShown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。