當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。