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


Java LinearLayout.removeViews方法代码示例

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


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

示例1: setPreviewColor

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void setPreviewColor() {
	if (mView == null) return;
	ImageView iView = new ImageView(getContext());
	LinearLayout widgetFrameView = ((LinearLayout)mView.findViewById(android.R.id.widget_frame));
	if (widgetFrameView == null) return;
	widgetFrameView.setVisibility(View.VISIBLE);
	widgetFrameView.setPadding(
		widgetFrameView.getPaddingLeft(),
		widgetFrameView.getPaddingTop(),
		(int)(mDensity * 8),
		widgetFrameView.getPaddingBottom()
	);
	// remove already create preview image
	int count = widgetFrameView.getChildCount();
	if (count > 0) {
		widgetFrameView.removeViews(0, count);
	}
	widgetFrameView.addView(iView);
	widgetFrameView.setMinimumWidth(0);
	iView.setBackgroundDrawable(new AlphaPatternDrawable((int)(5 * mDensity)));
	iView.setImageBitmap(getPreviewBitmap());
}
 
开发者ID:Bregnet,项目名称:TextView_CustomEdit_CustomColor,代码行数:23,代码来源:ColorPickerPreference.java

示例2: setPreviewColor

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void setPreviewColor() {
	if (mView == null) return;
	ImageView iView = new ImageView(getContext());
	LinearLayout widgetFrameView = ((LinearLayout)mView.findViewById(android.R.id.widget_frame));
	if (widgetFrameView == null) return;
	widgetFrameView.setVisibility(View.VISIBLE);
	widgetFrameView.setPadding(
		widgetFrameView.getPaddingLeft(),
		widgetFrameView.getPaddingTop(),
		(int)(mDensity * 8),
		widgetFrameView.getPaddingBottom()
	);
	// remove already create preview image
	int count = widgetFrameView.getChildCount();
	if (count > 0) {
		widgetFrameView.removeViews(0, count);
	}
	widgetFrameView.addView(iView);
	widgetFrameView.setMinimumWidth(0);
	iView.setBackground(new AlphaPatternDrawable((int)(5 * mDensity)));
	iView.setImageBitmap(getPreviewBitmap());
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:ColorPickerPreference.java

示例3: updateLayout

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void updateLayout(Activity activity) {
	
	final LayoutInflater inflater = activity.getLayoutInflater();
	final ArrayList<Setting> settings = mApp.getSettings();
	final int settingCount = getSettingsCount(settings);
	final LinearLayout layout = mList;

	// Go through all settings and ensure they have corresponding 
	// views in the layout. Then remove not used views in such.
	
	for (int settingIndex = 0; settingIndex < settingCount; settingIndex++) {

		int layoutIndex = settingIndex << 1;
		View layoutView = layout.getChildCount() < layoutIndex ? null : layout.getChildAt(layoutIndex);

		Setting setting = settings.get(settingIndex + 1);
		View settingView = setting.getAssignedRenderer().getView(inflater, setting, null, activity);
		
		if (layoutView == null) {
			// we just need to append setting view

			safelyRemoveViewFromParent(layout, layoutIndex, settingView);

    		// add setting view
    		layout.addView(settingView);
    		
			// add delimiter if it is not the last setting
			ImageView delimiter = new ImageView(activity);
			delimiter.setImageResource(android.R.drawable.divider_horizontal_dim_dark);
			layout.addView(delimiter);
			settingView.setTag(delimiter);
			
		} else if (layoutView != settingView) {
			
			// we just need to remove current view and put setting view instead
			// replace view
			layout.removeView(layoutView);

    		// detach it from a parent if there is a parent
			safelyRemoveViewFromParent(layout, layoutIndex, settingView);
			
			layout.addView(settingView, layoutIndex); // add setting view
			settingView.setTag(layout.getChildAt(layoutIndex + 1)); // reuse delimiter
		} 
		// else - do nothing, this is same view
		
	}
	
	// if we have more views then settings, we have to remove redundant views
	final int layoutCount = layout.getChildCount();
	final int expectedCount = settingCount << 1;
	if (layoutCount > expectedCount) {
		layout.removeViews(expectedCount, layoutCount - expectedCount);
	}
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:56,代码来源:ListSettingsLayout.java

示例4: deleteArgument

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * Procedure deletes argument layout for given term and returns the previous term
 */
protected TermField deleteArgument(TermField owner, String sep, boolean storeUndoState)
{
    // target layout where terms will be deleted
    View expandable = owner.getLayout();
    if (expandable == null)
    {
        return null;
    }
    LinearLayout expandableLayout = (LinearLayout) expandable;

    // view index of the field within the parent layout
    int startIndex = ViewUtils.getViewIndex(expandableLayout, owner.getEditText());
    if (startIndex < 0)
    {
        return null;
    }

    // how much views shall be deleted:
    int count = 1;
    {
        final String termKey = getContext().getResources().getString(R.string.formula_arg_term_key);
        final boolean firstTerm = owner.getTermKey().equals(termKey + String.valueOf(1));
        if (firstTerm && startIndex + 1 < expandableLayout.getChildCount()
                && expandableLayout.getChildAt(startIndex + 1) instanceof CustomTextView)
        {
            final CustomTextView next = ((CustomTextView) expandableLayout.getChildAt(startIndex + 1));
            if (next.getText().toString().equals(sep))
            {
                count++;
            }
        }
        else if (!firstTerm && startIndex >= 1
                && expandableLayout.getChildAt(startIndex - 1) instanceof CustomTextView)
        {
            final CustomTextView prev = ((CustomTextView) expandableLayout.getChildAt(startIndex - 1));
            if (prev.getText().toString().equals(sep))
            {
                startIndex--;
                count++;
            }
        }
    }

    if (storeUndoState && parentField != null)
    {
        getFormulaList().getUndoState().addEntry(parentField.getState());
    }
    int prevIndex = terms.indexOf(owner);
    prevIndex--;
    terms.remove(owner);
    expandableLayout.removeViews(startIndex, count);
    reIndexTerms();

    return (prevIndex >= 0) ? terms.get(prevIndex) : null;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:59,代码来源:FormulaTerm.java


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