本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例6: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.invalidate();
}
示例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();
}
}
示例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();
}