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


Java ViewGroup.invalidate方法代码示例

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


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

示例1: applyTo

import android.view.ViewGroup; //导入方法依赖的package包/类
public void applyTo(View target) {
    LayoutParams lp = target.getLayoutParams();
    ViewParent parent = target.getParent();
    FrameLayout container = new FrameLayout(this.context);
    if (target instanceof TabWidget) {
        target = ((TabWidget) target).getChildTabViewAt(this.targetTabIndex);
        this.target = target;
        ((ViewGroup) target).addView(container, new LayoutParams(-1, -1));
        setVisibility(8);
        container.addView(this);
        return;
    }
    ViewGroup group = (ViewGroup) parent;
    int index = group.indexOfChild(target);
    group.removeView(target);
    group.addView(container, index, lp);
    container.addView(target);
    setVisibility(8);
    container.addView(this);
    group.invalidate();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:BadgeView.java

示例2: applyTo

import android.view.ViewGroup; //导入方法依赖的package包/类
private void applyTo(View target) {
    LayoutParams lp = target.getLayoutParams();
    ViewParent parent = target.getParent();
    FrameLayout container = new FrameLayout(this.context);
    ViewGroup group = (ViewGroup) parent;
    int index = group.indexOfChild(target);
    group.removeView(target);
    group.addView(container, index, lp);
    container.addView(target);
    container.addView(this);
    group.invalidate();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:BottomRedPointView.java

示例3: displayStory

import android.view.ViewGroup; //导入方法依赖的package包/类
private void displayStory(Story story, final String storyId) {
    final StorageReference storageRef = mStorage.getReference();

    if (story.getEmoji() != null && story.getEmoji().length() > 0) {
        // prioritize emoji
        String[] emojiArray = story.getEmoji().split(" ");

        mStoryAdapter.addEmoji(Arrays.asList(emojiArray), storyId);

    }

    // Refresh the screen
    ViewGroup rootLayout = (ViewGroup) findViewById(R.id.rootLayout);
    rootLayout.invalidate();
}
 
开发者ID:mimming,项目名称:zero-to-app-emojistories,代码行数:16,代码来源:EmojiActivity.java

示例4: displayStory

import android.view.ViewGroup; //导入方法依赖的package包/类
private void displayStory(Story story, final String storyId) {
    final StorageReference storageRef = mStorage.getReference();

    if (story.getEmoji() != null && story.getEmoji().length() > 0) {
        // prioritize emoji
        String[] emojiArray = story.getEmoji().split(" ");

        mStoryAdapter.addEmoji(Arrays.asList(emojiArray), storyId);

        // and a photo (up to 10mb)
        if (story.getFilePath() != null && story.getFilePath().length() > 0) {

            mStoryAdapter.addImage(storageRef, story.getFilePath(), storyId);
        }

    } else if (story.getTitle() != null && story.getTitle().length() > 0) {

        // and a photo (up to 10mb)
        if (story.getFilePath() != null && story.getFilePath().length() > 0) {
            Task<byte[]> imageDownloadTask = storageRef.child(story.getFilePath()).getBytes(100 * 1024 * 1024);
            imageDownloadTask.addOnCompleteListener(new OnCompleteListener<byte[]>() {
                @Override
                public void onComplete(@NonNull Task<byte[]> task) {
                    mStoryAdapter.addImage(task.getResult(), storyId);
                }
            });
        }

        // no emoji?  Display title
        mStoryAdapter.addMessage(story.getTitle(), storyId);
    }

    // Refresh the screen
    ViewGroup rootLayout = (ViewGroup) findViewById(R.id.rootLayout);
    rootLayout.invalidate();
}
 
开发者ID:mimming,项目名称:zero-to-app-emojistories,代码行数:37,代码来源:MainActivityComplete.java

示例5: clearClippedChildren

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * Clear the animation garbage of the target view.
 */
private static void clearClippedChildren(ViewGroup viewGroup) {
    viewGroup.setClipChildren(true);
    viewGroup.invalidate();
    viewGroup.setClipChildren(false);
}
 
开发者ID:cheenid,项目名称:FLFloatingButton,代码行数:9,代码来源:TrashView.java

示例6: destroyItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.invalidate();
}
 
开发者ID:MaskedHawk,项目名称:Underlined,代码行数:5,代码来源:SwipeAdapter.java

示例7: applyTo

import android.view.ViewGroup; //导入方法依赖的package包/类
private void applyTo(View target)
{

	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);

	if (target instanceof TabWidget)
	{

		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;

		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

		this.setVisibility(View.GONE);
		container.addView(this);

	}
	else
	{

		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);

		group.removeView(target);
		group.addView(container, index, lp);

		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);

		group.invalidate();

	}

}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:42,代码来源:BadgeView.java

示例8: reorderChildrenByZIndex

import android.view.ViewGroup; //导入方法依赖的package包/类
public static void reorderChildrenByZIndex(ViewGroup view) {
  // Optimization: loop through the zIndexHash to test if there are any non-zero zIndexes
  // If there aren't any, we can just return out
  Collection<Integer> zIndexes = mZIndexHash.values();
  boolean containsZIndexedElement = false;
  for (Integer zIndex : zIndexes) {
    if (zIndex != 0) {
      containsZIndexedElement = true;
      break;
    }
  }
  if (!containsZIndexedElement) {
    return;
  }

  // Add all children to a sortable ArrayList
  ArrayList<View> viewsToSort = new ArrayList<>();
  for (int i = 0; i < view.getChildCount(); i++) {
    viewsToSort.add(view.getChildAt(i));
  }
  // Sort the views by zIndex
  Collections.sort(viewsToSort, new Comparator<View>() {
    @Override
    public int compare(View view1, View view2) {
      Integer view1ZIndex = mZIndexHash.get(view1);
      if (view1ZIndex == null) {
        view1ZIndex = 0;
      }

      Integer view2ZIndex = mZIndexHash.get(view2);
      if (view2ZIndex == null) {
        view2ZIndex = 0;
      }
      return view1ZIndex - view2ZIndex;
    }
  });
  // Call .bringToFront on the sorted list of views
  for (int i = 0; i < viewsToSort.size(); i++) {
    viewsToSort.get(i).bringToFront();
  }
  view.invalidate();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:43,代码来源:ViewGroupManager.java


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