Java Code Examples for android.widget.LinearLayout#removeViewAt()

The following examples show how to use android.widget.LinearLayout#removeViewAt() . 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 check out the related API usage on the sidebar.
Example 1
Source File: WheelRecycle.java    From RxTools-master with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 * 
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items 
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++; // go to next item
		}
		index++;
	}
	return firstItem;
}
 
Example 2
Source File: WheelRecycler.java    From RxTools-master with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 *
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current spinnerwheel items
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
    int index = firstItem;
    for (int i = 0; i < layout.getChildCount();) {
        if (!range.contains(index)) {
            recycleView(layout.getChildAt(i), index);
            layout.removeViewAt(i);
            if (i == 0) { // first item
                firstItem++;
            }
        } else {
            i++; // go to next item
        }
        index++;
    }
    return firstItem;
}
 
Example 3
Source File: WheelRecycle.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 * 
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items 
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++; // go to next item
		}
		index++;
	}
	return firstItem;
}
 
Example 4
Source File: WheelRecycle.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 *
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
    int index = firstItem;
    for (int i = 0; i < layout.getChildCount();) {
        if (!range.contains(index)) {
            recycleView(layout.getChildAt(i), index);
            layout.removeViewAt(i);
            if (i == 0) { // first item
                firstItem++;
            }
        } else {
            i++; // go to next item
        }
        index++;
    }
    return firstItem;
}
 
Example 5
Source File: WheelRecycle.java    From CoolClock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 * 
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items 
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++;
		}
		index++;
	}
	return firstItem;
}
 
Example 6
Source File: WheelRecycle.java    From Mupdf with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 *
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++; // go to next item
		}
		index++;
	}
	return firstItem;
}
 
Example 7
Source File: WheelRecycle.java    From myapplication with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 * 
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items 
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++; // go to next item
		}
		index++;
	}
	return firstItem;
}
 
Example 8
Source File: WheelRecycle.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 * 
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items 
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++; // go to next item
		}
		index++;
	}
	return firstItem;
}
 
Example 9
Source File: WheelRecycler.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 *
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current spinnerwheel items
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
    int index = firstItem;
    for (int i = 0; i < layout.getChildCount();) {
        if (!range.contains(index)) {
            recycleView(layout.getChildAt(i), index);
            layout.removeViewAt(i);
            if (i == 0) { // first item
                firstItem++;
            }
        } else {
            i++; // go to next item
        }
        index++;
    }
    return firstItem;
}
 
Example 10
Source File: WheelRecycle.java    From TimePickerDialog with Apache License 2.0 6 votes vote down vote up
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range, int currentItem) {
    int index = firstItem;
    for (int i = 0; i < layout.getChildCount(); ) {
        if (!range.contains(index)) {
            recycleView(layout.getChildAt(i), index, currentItem);
            layout.removeViewAt(i);
            if (i == 0) { // first item
                firstItem++;
            }
        } else {
            i++; // go to next item
        }
        index++;
    }
    return firstItem;
}
 
Example 11
Source File: WheelRecycle.java    From bither-android with Apache License 2.0 6 votes vote down vote up
/**
 * Recycles items from specified layout.
 * There are saved only items not included to specified range.
 * All the cached items are removed from original layout.
 * 
 * @param layout the layout containing items to be cached
 * @param firstItem the number of first item in layout
 * @param range the range of current wheel items 
 * @return the new value of first item number
 */
public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
	int index = firstItem;
	for (int i = 0; i < layout.getChildCount();) {
		if (!range.contains(index)) {
			recycleView(layout.getChildAt(i), index);
			layout.removeViewAt(i);
			if (i == 0) { // first item
				firstItem++;
			}
		} else {
			i++; // go to next item
		}
		index++;
	}
	return firstItem;
}
 
Example 12
Source File: WheelRecycle.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public int recycleItems(LinearLayout linearlayout, int i, ItemsRange itemsrange)
{
    int j = 0;
    int k = i;
    while (j < linearlayout.getChildCount()) 
    {
        if (!itemsrange.contains(i))
        {
            a(linearlayout.getChildAt(j), i);
            linearlayout.removeViewAt(j);
            if (j == 0)
            {
                k++;
            }
        } else
        {
            j++;
        }
        i++;
    }
    return k;
}
 
Example 13
Source File: DialogActivity.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
public void onClick(View v) {
    LinearLayout layout = (LinearLayout)findViewById(R.id.inner_content);
    int num = layout.getChildCount();
    if (num > 0) {
        layout.removeViewAt(num-1);
    }
}
 
Example 14
Source File: WebViewActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 把系统自身请求失败时的网页隐藏
 */
protected void hideErrorPage() {
    LinearLayout webParentView = (LinearLayout) mWebView.getParent();
    mIsErrorPage = false;
    while (webParentView.getChildCount() > 1) {
        webParentView.removeViewAt(0);
    }
}
 
Example 15
Source File: CollectionView.java    From v2ex with Apache License 2.0 5 votes vote down vote up
private View recycleItemRow(View convertView, RowComputeResult rowInfo) {
    int i;
    LinearLayout ll = (LinearLayout) convertView;
    for (i = 0; i < rowInfo.group.mDisplayCols; i++) {
        View view = ll.getChildAt(i);
        View newView = getItemView(rowInfo, i, view, ll);
        if (view != newView) {
            LinearLayout.LayoutParams thisViewParams = setupLayoutParams(newView);
            ll.removeViewAt(i);
            ll.addView(newView, i, thisViewParams);
        }
    }
    return ll;
}
 
Example 16
Source File: BreadcrumbScrollView.java    From BreadcrumbToolbar with Apache License 2.0 5 votes vote down vote up
public void removeBreadcrumbItemFrom(int position) {
    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.breadcrumb_scroll_view_inner_layout);

    Log.d(TAG, "[toolbar] removeBreadcrumbItemFrom getChildCount():" + linearLayout.getChildCount() + " position:" + position);
    for (int i = linearLayout.getChildCount(); i > position; i--) {
        Log.d(TAG, "[toolbar] remove i:" + i + " ->" + (i - 1));
        if (linearLayout.getChildAt(i - 1) != null) {
            linearLayout.removeViewAt(i - 1);
        }
    }
}
 
Example 17
Source File: GridListAdapter.java    From pandroid with Apache License 2.0 5 votes vote down vote up
/**
 * Update a existing view with some column.
 *
 * @param position  Current position of the cell.
 * @param viewGroup Container of the cell.
 * @param layout    Layout saved of the cell.
 */
private void updateItemRow(int position, ViewGroup viewGroup, LinearLayout layout) {
    // we remove view that aren't needed for the row
    while(layout.getChildCount()>rows.get(position).size()){
        layout.removeViewAt(layout.getChildCount()-1);
    }

    for (int i = 0; i < rows.get(position).size(); i++) {
        int currentPos = rows.get(position).indexFirstItem + i;
        View insideView = layout.getChildAt(i);

        View theView = super.getView(currentPos, insideView, viewGroup);

        // Set the width of this column
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.weight = rows.get(position).get(i).colSpan;
        if (i != mNumColumns - 1)// last col
            params.setMargins(0, 0, cellMargin, 0);
        theView.setLayoutParams(params);

        theView.setOnClickListener(new ListItemClickListener(currentPos));
        if (!theView.equals(insideView)) {
            if (layout.getChildCount() > i) {
                layout.removeViewAt(i);
            }
            layout.addView(theView, i);
        }
    }
}
 
Example 18
Source File: BoardAdapter.java    From BoardView with Apache License 2.0 5 votes vote down vote up
public void removeItem(int column, int index){
    BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(column);
    ScrollView scrollView = (ScrollView)item.getChildAt(1);
    LinearLayout llColumn = (LinearLayout)scrollView.getChildAt(0);
    llColumn.removeViewAt(index);
    llColumn.invalidate();
    columns.get(column).objects.remove(index);
    columns.get(column).views.remove(index);
}
 
Example 19
Source File: AbstractElementAdapter.java    From gcm with Apache License 2.0 4 votes vote down vote up
protected void removeChild(LinearLayout layout, int position) {
    layout.removeViewAt(position);
}
 
Example 20
Source File: BreadcrumbScrollView.java    From BreadcrumbToolbar with Apache License 2.0 4 votes vote down vote up
public void popBreadcrumbItem(int position) {
    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.breadcrumb_scroll_view_inner_layout);
    if (linearLayout.getChildAt(position) != null) {
        linearLayout.removeViewAt(position);
    }
}