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


Java LinearLayout.removeView方法代码示例

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


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

示例1: remove

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void remove(ActivityTask.TaskInfo taskInfo) {
    int taskId = taskInfo.getTaskId();
    LinearLayout layout = mLayoutMap.get(taskId);
    if (layout == null) {
        Log.e(TAG, "LinearLayout not found");
        return;
    }
    ObserverTextView textView = mObserverTextViewMap.remove(taskInfo.getActivityId());
    if (textView == null) {
        Log.e(TAG, "ObserverTextView not found");
        return;
    }
    mObservable.deleteObserver(textView);
    layout.removeView(textView);
    Log.i(TAG, "removeObserverTextView " + taskId);
    if (layout.getChildCount() == 0) {
        mLayoutMap.remove(taskId);
        removeView(layout);
        Log.i(TAG, "removeLinearLayout " + taskId);
    }
}
 
开发者ID:rome753,项目名称:ActivityTaskView,代码行数:22,代码来源:ActivityTaskView.java

示例2: removeDeviceFromStory

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void removeDeviceFromStory(DeviceDAO deviceToFind) {
    final List<DeviceDAO> devices = story.getDevices();
    if (devices.remove(deviceToFind)) {
        this.lastRemovedDevice = deviceToFind;
    }
    story.setDevices(devices);
    LinearLayout mainLinearLayout = findViewById(R.id.mainLinearLayout);
    View deviceView = mainLinearLayout.findViewById(deviceToFind.getId());
    mainLinearLayout.removeView(deviceView);

    // Add the possibility to restore a device in the list
    Snackbar.make(mainLinearLayout, getString(R.string.snackbar_device_removed_from_story), Snackbar.LENGTH_LONG)
        .setAction(getString(R.string.cancel), new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (lastRemovedDevice != null) {
                    story.getDevices().add(lastRemovedDevice);
                    populateDevices();
                }
            }
        })
        .show();
    populateDevices();
}
 
开发者ID:MBach,项目名称:home-automation,代码行数:25,代码来源:StoryActivity.java

示例3: onPreExecute

import android.widget.LinearLayout; //导入方法依赖的package包/类
protected void onPreExecute() {
	super.onPreExecute();

	// Replace the ListView with a ProgressBar
	mProgBar = new ProgressBar(EDFileChooserActivity.this, null,
			android.R.attr.progressBarStyleLarge);

	// Set the layout to fill the screen
	mListView = EDFileChooserActivity.this.getListView();
	mLayout = (LinearLayout) mListView.getParent();
	mLayout.setGravity(Gravity.CENTER);
	mLayout.setLayoutParams(new FrameLayout.LayoutParams(
			LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

	// Set the ProgressBar in the center of the layout
	LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	layoutParams.gravity = Gravity.CENTER;
	mProgBar.setLayoutParams(layoutParams);

	// Replace the ListView with the ProgressBar
	mLayout.removeView(mListView);
	mLayout.addView(mProgBar);
	mProgBar.setVisibility(View.VISIBLE);
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:26,代码来源:EDFileChooserActivity.java

示例4: setContent

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void setContent() {
    if (!isShowBubble() && !isMiddleItem()) {
        return;
    }

    LinearLayout bodyContainer = (LinearLayout) view.findViewById(R.id.message_item_body);

    // 调整container的位置
    int index = isReceivedMessage() ? 0 : 3;
    if (bodyContainer.getChildAt(index) != contentContainer) {
        bodyContainer.removeView(contentContainer);
        bodyContainer.addView(contentContainer, index);
    }

    if (isMiddleItem()) {
        setGravity(bodyContainer, Gravity.CENTER);
    } else {
        if (isReceivedMessage()) {
            setGravity(bodyContainer, Gravity.LEFT);
            contentContainer.setBackgroundResource(leftBackground());
        } else {
            setGravity(bodyContainer, Gravity.RIGHT);
            contentContainer.setBackgroundResource(rightBackground());
        }
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:27,代码来源:MsgViewHolderBase.java

示例5: removeEntry

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void removeEntry(View view) {
    // Remove the last entry in the list
    LinearLayout entriesList = (LinearLayout) this.findViewById(R.id.entriesList);
    entriesList.removeView(entries.get(entries.size() - 1));
    entries.remove(entries.size() - 1);

    // Set the minus button's enabled state appropriately
    configureMinusButtonEnabledState();
}
 
开发者ID:Rifdhan,项目名称:android-random-selector,代码行数:10,代码来源:EnterOptionsActivity.java

示例6: deleteOpeView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void deleteOpeView(OperationView operationView){
    final LinearLayout listView=(LinearLayout) findViewById(R.id.opeListView);
    for(int i=0;i<listView.getChildCount();i++){
        if(listView.getChildAt(i)==operationView){
            operationView.operation.removeAllTrain();
            diaFile.operationList.get(diaNum).remove(operationView.operation);
            listView.removeView(operationView);
            break;
        }
    }
}
 
开发者ID:KameLong,项目名称:AOdia,代码行数:12,代码来源:OperationFragment.java

示例7: populateDevices

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 *
 */
private void populateDevices() {
    final LinearLayout mainLinearLayout = findViewById(R.id.mainLinearLayout);
    final CardView addPictureCard = findViewById(R.id.addPictureCard);

    for (final DeviceDAO deviceDAO : story.getDevices()) {
        final View previousDeviceView = mainLinearLayout.findViewById(deviceDAO.getId());
        if (previousDeviceView != null) {
            mainLinearLayout.removeView(previousDeviceView);
        }
        final View deviceView = getLayoutInflater().inflate(R.layout.story_activity_card_device, mainLinearLayout, false);

        // Pass args to buttons in order to perfom some actions on the device
        Button deleteDevice = deviceView.findViewById(R.id.delete_device);
        deleteDevice.setTag(R.id.cardDevice, deviceDAO);

        Button configureDevice = deviceView.findViewById(R.id.configure_device);
        configureDevice.setTag(R.id.cardDevice, deviceDAO);

        deviceView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                showRemoveDeviceDialog(deviceDAO);
                return true;
            }
        });

        // Hide the text if the device has no NetBios name (should be improved by the way)
        TextView name = deviceView.findViewById(R.id.name);
        if (deviceDAO.getName() == null) {
            name.setVisibility(View.GONE);
        } else {
            name.setText(deviceDAO.getName());
        }

        TextView ip = deviceView.findViewById(R.id.ip);
        ip.setText(deviceDAO.getIP());
        TextView vendor = deviceView.findViewById(R.id.vendor);
        vendor.setText(deviceDAO.getVendor());

        // Show the lock icon if device is password protected
        if (deviceDAO.isProtected()) {
            ImageView lockIcon = deviceView.findViewById(R.id.lockIcon);
            lockIcon.setVisibility(View.VISIBLE);
        }

        deviceView.setId(deviceDAO.getId());
        mainLinearLayout.addView(deviceView, mainLinearLayout.indexOfChild(addPictureCard));
    }
}
 
开发者ID:MBach,项目名称:home-automation,代码行数:53,代码来源:StoryActivity.java

示例8: onRemoteUserLeft

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public void onRemoteUserLeft(String userId, RongCallCommon.CallDisconnectedReason reason) {
    //incoming状态,localViewUserId为空
    if (localViewUserId == null)
        return;
    if (localViewUserId.equals(userId)) {
        localViewContainer.removeAllViews();
        String currentUserId = RongIMClient.getInstance().getCurrentUserId();
        FrameLayout remoteVideoView = (FrameLayout) remoteViewContainer.findViewWithTag(currentUserId);
        localView = (SurfaceView) remoteVideoView.getChildAt(0);
        remoteVideoView.removeAllViews();
        localViewContainer.addView(localView);
        TextView topUserNameView = (TextView) topContainer.findViewById(R.id.rc_voip_user_name);
        topUserNameView.setTag(currentUserId + "name");
        UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(currentUserId);
        if (userInfo != null) {
            topUserNameView.setText(userInfo.getName());
        } else {
            topUserNameView.setText(currentUserId);
        }
        localViewUserId = currentUserId;
    }

    View singleRemoteView = remoteViewContainer.findViewWithTag(userId + "view");

    if (singleRemoteView == null)
        return;

    LinearLayout container = (LinearLayout) singleRemoteView.getParent();
    container.removeView(singleRemoteView);
    if (container.equals(remoteViewContainer2)) {
        if (remoteViewContainer1.getChildCount() > 0) {
            View childView = remoteViewContainer1.getChildAt(0);
            remoteViewContainer1.removeView(childView);
            remoteViewContainer2.addView(childView);
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:39,代码来源:MultiVideoCallActivity.java

示例9: removeChild

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void removeChild(String childId) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    List<LinearLayout> containerList = new ArrayList<>();
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        containerList.add(container);
    }
    for (LinearLayout resultContainer : containerList) {
        if (lastContainer == null) {
            LinearLayout child = (LinearLayout) resultContainer.findViewWithTag(childId);
            if (child != null) {
                resultContainer.removeView(child);
                if (resultContainer.getChildCount() == 0) {
                    linearLayout.removeView(resultContainer);
                    break;
                } else {
                    lastContainer = resultContainer;
                }
            }
        } else {
            View view = resultContainer.getChildAt(0);
            resultContainer.removeView(view);
            lastContainer.addView(view);
            if (resultContainer.getChildCount() == 0) {
                linearLayout.removeView(resultContainer);
                break;
            } else {
                lastContainer = resultContainer;
            }
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:35,代码来源:CallUserGridView.java

示例10: addIcon

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * Adds an icon with a descriptive message to the layout.
 *
 * -----------------------------------------------------
 * | ICON | PRIMARY MESSAGE SECONDARY MESSAGE          |
 * -----------------------------------------------------
 * If an icon is not provided, the ImageView that would normally show it is hidden.
 *
 * @param iconResourceId   ID of the drawable to use for the icon.
 * @param iconColorId      ID of the tint color for the icon, or 0 for default.
 * @param primaryMessage   Message to display for the toggle.
 * @param secondaryMessage Additional descriptive text for the toggle.  May be null.
 */
public View addIcon(int iconResourceId, int iconColorId, CharSequence primaryMessage,
        CharSequence secondaryMessage) {
    LinearLayout layout = (LinearLayout) LayoutInflater.from(getContext()).inflate(
            R.layout.infobar_control_icon_with_description, this, false);
    addView(layout, new ControlLayoutParams());

    ImageView iconView = (ImageView) layout.findViewById(R.id.control_icon);
    iconView.setImageResource(iconResourceId);
    if (iconColorId != 0) {
        iconView.setColorFilter(ApiCompatibilityUtils.getColor(getResources(), iconColorId));
    }

    // The primary message text is always displayed.
    TextView primaryView = (TextView) layout.findViewById(R.id.control_message);
    primaryView.setText(primaryMessage);

    // The secondary message text is optional.
    TextView secondaryView =
            (TextView) layout.findViewById(R.id.control_secondary_message);
    if (secondaryMessage == null) {
        layout.removeView(secondaryView);
    } else {
        secondaryView.setText(secondaryMessage);
    }

    return layout;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:InfoBarControlLayout.java

示例11: addSwitch

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * Creates a standard toggle switch and adds it to the layout.
 *
 * -------------------------------------------------
 * | ICON | MESSAGE                       | TOGGLE |
 * -------------------------------------------------
 * If an icon is not provided, the ImageView that would normally show it is hidden.
 *
 * @param iconResourceId ID of the drawable to use for the icon, or 0 to hide the ImageView.
 * @param iconColorId    ID of the tint color for the icon, or 0 for default.
 * @param toggleMessage  Message to display for the toggle.
 * @param toggleId       ID to use for the toggle.
 * @param isChecked      Whether the toggle should start off checked.
 */
public View addSwitch(int iconResourceId, int iconColorId, CharSequence toggleMessage,
        int toggleId, boolean isChecked) {
    LinearLayout switchLayout = (LinearLayout) LayoutInflater.from(getContext()).inflate(
            R.layout.infobar_control_toggle, this, false);
    addView(switchLayout, new ControlLayoutParams());

    ImageView iconView = (ImageView) switchLayout.findViewById(R.id.control_icon);
    if (iconResourceId == 0) {
        switchLayout.removeView(iconView);
    } else {
        iconView.setImageResource(iconResourceId);
        if (iconColorId != 0) {
            iconView.setColorFilter(
                    ApiCompatibilityUtils.getColor(getResources(), iconColorId));
        }
    }

    TextView messageView = (TextView) switchLayout.findViewById(R.id.control_message);
    messageView.setText(toggleMessage);

    SwitchCompat switchView =
            (SwitchCompat) switchLayout.findViewById(R.id.control_toggle_switch);
    switchView.setId(toggleId);
    switchView.setChecked(isChecked);

    return switchLayout;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:42,代码来源:InfoBarControlLayout.java

示例12: safelyRemoveViewFromParent

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
   * removes setting view and its delimiter from a parent
   * @param layout
   * @param layoutIndex
   * @param settingView
   */
  private void safelyRemoveViewFromParent(LinearLayout layout, int layoutIndex, View settingView) {
  	LinearLayout parent = (LinearLayout) settingView.getParent();
if (parent != null) { 
	View delimiter = (View) settingView.getTag();
	parent.removeView(settingView);
	parent.removeView(delimiter);
}
  }
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:15,代码来源:ListSettingsLayout.java

示例13: onPreExecute

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
	try {//sometime it crash if the user refresh while the list is already being refreshed
		super.onPreExecute();

		// Replace the ListView with a ProgressBar
		mProgBar = new ProgressBar(volumeBrowserActivity, null,android.R.attr.progressBarStyleLarge);

		// Set the layout to fill the screen
		mListView = volumeBrowserActivity.getListView();
		mLayout = (LinearLayout) mListView.getParent();
		if (mLayout==null) return;
		mLayout.setGravity(Gravity.CENTER);
		mLayout.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

		// Set the ProgressBar in the center of the layout
		LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		layoutParams.gravity = Gravity.CENTER;
		mProgBar.setLayoutParams(layoutParams);

		// Replace the ListView with the ProgressBar
		mLayout.removeView(mListView);
		mLayout.addView(mProgBar);
		mProgBar.setVisibility(View.VISIBLE);
	} catch (Exception e){
		e.printStackTrace();
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:31,代码来源:FillTask.java

示例14: EditorView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public EditorView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);


    inflater = LayoutInflater.from(context);

    allLayout = new LinearLayout(context);
    allLayout.setOrientation(LinearLayout.VERTICAL);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(allLayout, layoutParams);

    onClickListener = new OnClickListener() {
        @Override
        public void onClick(View view) {
            allLayout.removeView(view);
        }
    };

    focusChangeListener = new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                lastEditText = (EditText) view;
            }
        }
    };

    keyListener = new OnKeyListener() {
        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if (keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getKeyCode() == KeyEvent.KEYCODE_DEL) {
                EditText editText = (EditText) view;
                onBackPress(editText);
            }
            return false;
        }
    };

    EditText e = createEditText("Title", dip2px(10));
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    allLayout.addView(e, p);

    EditText content = createEditText("Enter Description or Insert Any Image.\nSize of Description should be less than 200", dip2px(10));
    LinearLayout.LayoutParams contentp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    allLayout.addView(content, contentp
    );
    lastEditText = content;

}
 
开发者ID:appteam-nith,项目名称:Hillffair17,代码行数:50,代码来源:EditorView.java

示例15: EditorView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public EditorView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);


    inflater = LayoutInflater.from(context);

    allLayout = new LinearLayout(context);
    allLayout.setOrientation(LinearLayout.VERTICAL);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(allLayout, layoutParams);

    onClickListener = new OnClickListener() {
        @Override
        public void onClick(View view) {
            allLayout.removeView(view);
        }
    };

    focusChangeListener = new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                lastEditText = (EditText) view;
            }
        }
    };

    keyListener = new OnKeyListener() {
        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if (keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getKeyCode() == KeyEvent.KEYCODE_DEL) {
                EditText editText = (EditText) view;
                onBackPress(editText);
            }
            return false;
        }
    };

    EditText e = createEditText("Title", dip2px(10));
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    allLayout.addView(e, p);

    EditText content = createEditText("Enter Description or Insert Any Image", dip2px(10));
    LinearLayout.LayoutParams contentp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    allLayout.addView(content, contentp
    );
    lastEditText = content;

}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:50,代码来源:EditorView.java


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