android.view.View.isShown()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(238)

本文整理了Java中android.view.View.isShown()方法的一些代码示例,展示了View.isShown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.isShown()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:isShown

View.isShown介绍

暂无

代码示例

代码示例来源:origin: Bilibili/DanmakuFlameMaster

@Override
public boolean isShown() {
  return mDanmakuVisible && super.isShown();
}

代码示例来源:origin: RobotiumTech/robotium

@Override
  public boolean isSatisfied() {
    return leftDrawer.isShown();
  }
};

代码示例来源:origin: JohnPersano/SuperToasts

/**
 * Returns true if the SuperToast is showing.
 *
 * @return true if the SuperToast is showing
 */
public boolean isShowing() {
  return mView != null && mView.isShown();
}

代码示例来源:origin: RobotiumTech/robotium

/**
 * Removes invisible Views.
 * 
 * @param viewList an Iterable with Views that is being checked for invisible Views
 * @return a filtered Iterable with no invisible Views
 */
public static <T extends View> ArrayList<T> removeInvisibleViews(Iterable<T> viewList) {
  ArrayList<T> tmpViewList = new ArrayList<T>();
  for (T view : viewList) {
    if (view != null && view.isShown()) {
      tmpViewList.add(view);
    }
  }
  return tmpViewList;
}

代码示例来源:origin: novoda/android-demos

private void shortToast(String s) {
  toast.setText(s);
  if(!toast.getView().isShown()){
    toast.show();
  }
}

代码示例来源:origin: square/assertj-android

public S isShown() {
 isNotNull();
 assertThat(actual.isShown()) //
   .overridingErrorMessage("Expected to be shown but was not") //
   .isTrue();
 return myself;
}

代码示例来源:origin: square/assertj-android

public S isNotShown() {
 isNotNull();
 assertThat(actual.isShown()) //
   .overridingErrorMessage("Expected to not be shown but was") //
   .isFalse();
 return myself;
}

代码示例来源:origin: RobotiumTech/robotium

/**
 * Checks that the specified DecorView and the Activity DecorView are not equal.
 * 
 * @param activity the activity which DecorView is to be compared
 * @param decorView the DecorView to compare
 * @return true if not equal
 */

private boolean isDialog(Activity activity, View decorView){
  if(decorView == null || !decorView.isShown() || activity == null){
    return false;
  }
  Context viewContext = null;
  if(decorView != null){
    viewContext = decorView.getContext();
  }
  
  if (viewContext instanceof ContextThemeWrapper) {
    ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
    viewContext = ctw.getBaseContext();
  }
  Context activityContext = activity;
  Context activityBaseContext = activity.getBaseContext();
  return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext)) && (decorView != activity.getWindow().getDecorView());
}

代码示例来源:origin: robolectric/robolectric

/**
 * Utility method for clicking on views exposing testing scenarios that are not possible when using the actual app.
 *
 * @throws RuntimeException if the view is disabled or if the view or any of its parents are not visible.
 * @return Return value of the underlying click operation.
 */
public boolean checkedPerformClick() {
 if (!realView.isShown()) {
  throw new RuntimeException("View is not visible and cannot be clicked");
 }
 if (!realView.isEnabled()) {
  throw new RuntimeException("View is not enabled and cannot be clicked");
 }
 AccessibilityUtil.checkViewIfCheckingEnabled(realView);
 return realView.performClick();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void itKnowsIfTheViewIsNotShown() {
 view.setVisibility(View.GONE);
 assertThat(view.isShown()).isFalse();
 view.setVisibility(View.INVISIBLE);
 assertThat(view.isShown()).isFalse();
}

代码示例来源:origin: wangdan/AisenWeiBo

private void hideEmotionView(boolean showKeyBoard) {
  if (layEmotion.isShown()) {
    if (showKeyBoard) {
      LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams) layContainer.getLayoutParams();
      localLayoutParams.height = layEmotion.getTop();
      localLayoutParams.weight = 0.0F;
      layEmotion.setVisibility(View.GONE);
      getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
      SystemUtils.showKeyBoard(getActivity(), editContent);
      editContent.postDelayed(new Runnable() {
        @Override
          public void run() {
            unlockContainerHeightDelayed();
          }
      }, 200L);
    } else {
      layEmotion.setVisibility(View.GONE);
      getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
      unlockContainerHeightDelayed();
    }
  }
}

代码示例来源:origin: seven332/EhViewer

if (child.isShown()
    && Math.abs(currentTransY - targetTransY) > (child.getHeight() * 0.667f)) {

代码示例来源:origin: RobotiumTech/robotium

/**
 * Returns the most recent view container
 *
 * @param views the views to check
 * @return the most recent view container
 */
private final View getRecentContainer(View[] views) {
  View container = null;
  long drawingTime = 0;
  View view;
  for(int i = 0; i < views.length; i++){
    view = views[i];
    if (view != null && view.isShown() && view.hasWindowFocus() && view.getDrawingTime() > drawingTime) {
      container = view;
      drawingTime = view.getDrawingTime();
    }
  }
  return container;
}

代码示例来源:origin: wangdan/AisenWeiBo

/**
 * 切换表情跟键盘
 *
 * @param v
 */
void switchEmotionSoftinput(View v) {
  if (layEmotion.isShown()) {
    hideEmotionView(true);
  } else {
    showEmotionView(SystemUtils.isKeyBoardShow(getActivity()));
  }
}

代码示例来源:origin: arimorty/floatingsearchview

@Override
public void onGlobalLayout() {
  if (isShowing()) {
    final View anchor = mAnchorView;
    if (anchor == null || !anchor.isShown()) {
      dismiss();
    } else if (isShowing()) {
      // Recompute window size and position
      mPopup.show();
    }
  }
}
@Override

代码示例来源:origin: RobotiumTech/robotium

if(checkIsShown && foundAnyMatchingView && !view.isShown()){
  sleeper.sleepMini();
  retry++;

代码示例来源:origin: RobotiumTech/robotium

if(leftDrawer != null && homeView != null && leftDrawer.isShown()){
  clicker.clickOnScreen(homeView);
if(leftDrawer != null && homeView != null &&  !leftDrawer.isShown()){
  clicker.clickOnScreen(homeView);

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldKnowIfThisOrAncestorsAreVisible() throws Exception {
 assertThat(view.isShown()).named("view isn't considered shown unless it has a view root").isFalse();
 shadowOf(view).setMyParent(ReflectionHelpers.createNullProxy(ViewParent.class));
 assertThat(view.isShown()).isTrue();
 shadowOf(view).setMyParent(null);
 ViewGroup parent = new LinearLayout(context);
 parent.addView(view);
 ViewGroup grandParent = new LinearLayout(context);
 grandParent.addView(parent);
 grandParent.setVisibility(View.GONE);
 assertFalse(view.isShown());
}

代码示例来源:origin: wangdan/AisenWeiBo

@Override
public boolean onBackClick() {
  if (layEmotion.isShown()) {
    hideEmotionView(false);
    return true;
  }
  else if (!TextUtils.isEmpty(getPublishBean().getText()) || getPublishBean().getPics() != null) {
    askSaveToDraft();
    return true;
  }
  return super.onBackClick();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void itKnowsIfTheViewIsShown() {
 shadowOf(view).setMyParent(ReflectionHelpers.createNullProxy(ViewParent.class)); // a view is only considered visible if it is added to a view root
 view.setVisibility(View.VISIBLE);
 assertThat(view.isShown()).isTrue();
}

相关文章

微信公众号

最新文章

更多

View类方法