Java Code Examples for android.view.ViewGroup#bringChildToFront()

The following examples show how to use android.view.ViewGroup#bringChildToFront() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: backstack   File:    License: Apache License 2.0 6 votes vote down vote up
 * Helper function to disable a ViewGroup and all it's children. This draws a new view with z-ordering of integer max
 * that consumes all touch events.
 * @param viewGroup
public static void disable(ViewGroup viewGroup){
    View view = new View(viewGroup.getContext());

    ViewGroup.LayoutParams params = view.getLayoutParams();
    params.height = MATCH_PARENT;
    params.width = MATCH_PARENT;


    if (Build.VERSION.SDK_INT >= 21) {
Example 2
public static void sendToBack(View view) {
     * There is no single "send to back" method in Android. Instead, move
     * everything "under" this view to the front, one at a time. Also have
     * to do that for the views "above" this view, so they take back their
     * rightful place at the top after the lower views have been moved above
     * them by "bringChildToFront". When all is said and done, this view
     * will be sitting at the bottom, and the views above it will retain
     * their original order. In Android L (as part of Material Design),
     * view's will have an `elevation` property for this.
    if (view != null && view.getParent() instanceof ViewGroup) {
        ViewGroup parent = (ViewGroup) view.getParent();
        int thisIndex = parent.indexOfChild(view);
        for (int i = 0; i < parent.getChildCount(); i++) {
            if (i < thisIndex) {
            } else if (i > thisIndex) {
Example 3
Source Project: NewsMe   File:    License: Apache License 2.0 5 votes vote down vote up
public void reset() {
    // TODO Auto-generated method stub
    ViewGroup vg = (ViewGroup) getParent();
    if (!(vg.getChildAt(0) instanceof VDVideoTipsContainer)) {
        // 确保,这个ViewGroup在父View的最上面
    VDVideoViewController controller = VDVideoViewController.getInstance(this.getContext());
Example 4
Source Project: aurora-imui   File:    License: MIT License 5 votes vote down vote up
private void moveToBack(View currentView) {
    ViewGroup viewGroup = ((ViewGroup) currentView.getParent());
    int index = viewGroup.indexOfChild(currentView);
    for (int i = 0; i < index; i++) {