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


Java LinearLayout.removeAllViews方法代码示例

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


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

示例1: updateTable

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void updateTable(List<LivePvDatum> livePvData) {
    LinearLayout linearLayout = (LinearLayout) fragmentView.findViewById(R.id.table);
    linearLayout.removeAllViews();

    for (int i = livePvData.size() - 1; i >= 0; i--) {
        LivePvDatum livePvDatum = livePvData.get(i);
        View row = layoutInflater.inflate(R.layout.row_live, null);
        ((TextView) row.findViewById(R.id.time)).setText(DateTimeUtils.formatTime(
                livePvDatum.getHour(),
                livePvDatum.getMinute(),
                true));
        ((TextView) row.findViewById(R.id.power)).setText(
                FormatUtils.POWER_FORMAT.format(livePvDatum.getPowerGeneration()));
        ((TextView) row.findViewById(R.id.energy)).setText(
                FormatUtils.ENERGY_FORMAT.format(livePvDatum.getEnergyGeneration() / 1000.0));
        linearLayout.addView(row);
    }
}
 
开发者ID:jansipke,项目名称:pvdisplay,代码行数:19,代码来源:LiveFragment.java

示例2: updateTable

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void updateTable(List<DailyPvDatum> dailyPvData) {
    LinearLayout linearLayout = (LinearLayout) fragmentView.findViewById(R.id.table);
    linearLayout.removeAllViews();

    for (int i = dailyPvData.size() - 1; i >= 0; i--) {
        DailyPvDatum dailyPvDatum = dailyPvData.get(i);
        View row = layoutInflater.inflate(R.layout.row_day, null);
        ((TextView) row.findViewById(R.id.day)).setText(
                DateTimeUtils.getDayOfWeek(
                        dailyPvDatum.getYear(),
                        dailyPvDatum.getMonth(),
                        dailyPvDatum.getDay()) + " " +
                dailyPvDatum.getDay());
        final Drawable drawable = getDrawable(dailyPvDatum.getCondition());
        if (drawable != null) {
            ((ImageView) row.findViewById(R.id.condition)).setImageDrawable(
                    drawable);
        }
        ((TextView) row.findViewById(R.id.peak)).setText(
                FormatUtils.POWER_FORMAT.format(dailyPvDatum.getPeakPower()));
        ((TextView) row.findViewById(R.id.energy)).setText(
                FormatUtils.ENERGY_FORMAT.format(dailyPvDatum.getEnergyGenerated() / 1000.0));
        linearLayout.addView(row);
    }
}
 
开发者ID:jansipke,项目名称:pvdisplay,代码行数:26,代码来源:DailyFragment.java

示例3: onPostExecute

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void onPostExecute(ClassifyTaskResult result) {
    ProgressBar progressSpinner = (ProgressBar)findViewById(R.id.loadingSpinner);
    progressSpinner.setVisibility(View.GONE);

    if (result != null) {
        // If not null send the full result from ToneAnalyzer to our UI Builder class.
        RecognitionResultBuilder resultBuilder = new RecognitionResultBuilder(MainActivity.this);
        LinearLayout resultLayout = (LinearLayout) findViewById(R.id.recognitionResultLayout);

        if(resultLayout != null){
            resultLayout.removeAllViews();
        }
        LinearLayout recognitionView = resultBuilder.buildRecognitionResultView(result.getVisualClassification(), result.getDetectedFaces());

        resultLayout.addView(recognitionView);
    }
}
 
开发者ID:sebros,项目名称:vollDeinBier,代码行数:19,代码来源:MainActivity.java

示例4: onCreateViewHolder

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public BaseRvViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rv_state_layout,null);
    //如果调用者没有设置显示的View就用默认的View
    if(mView == null){
        mView = getDefaultView(parent.getContext());
    }
    if(mView!=null){
        LinearLayout container = (LinearLayout) view.findViewById(R.id.rv_cell_state_root_layout);
        container.removeAllViews();
        container.addView(mView);
    }
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    if(mHeight > 0){
        params.height = mHeight;
    }
    view.setLayoutParams(params);
    return new BaseRvViewHolder(view);
}
 
开发者ID:yangchong211,项目名称:YCBaseAdapter,代码行数:20,代码来源:BaseStateCell.java

示例5: bindMessages

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void bindMessages() {
    LinearLayout container = (LinearLayout) findViewById(R.id.messageContainer);
    container.removeAllViews();
    ResPartner partner = new ResPartner(getContext());
    for (ListRow message : mailMessage.select(null, "date DESC", "model = ? and res_id = ?", model.getModelName(), server_id + "")) {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.chatter_message_item, container, false);

        ListRow partnerObj = partner.browse(message.getInt("author_id"));
        CBind.setText((TextView) view.findViewById(R.id.messageAuthor), partnerObj.getString("name"));
        if (!partnerObj.getString("image_medium").equals("false")) {
            ImageView avatar = (ImageView) view.findViewById(R.id.authorImage);
            avatar.setImageBitmap(BitmapUtils.getBitmapImage(getContext(), partnerObj.getString("image_medium")));
        }
        CBind.setText((TextView) view.findViewById(R.id.messageDate), ODateUtils.parseDate(ODateUtils.convertToDefault(message.getString("date"), ODateUtils.DEFAULT_FORMAT),
                ODateUtils.DEFAULT_FORMAT, "dd MMM, hh:mm a"));
        CBind.setSpannableText(view.findViewById(R.id.messageBody), Html.fromHtml(message.getString("body")));
        container.addView(view);
    }
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:20,代码来源:ChatterView.java

示例6: onBindView

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public void onBindView(View view) {
    // Note: The efficiency could be improved by trying to recycle the buttons created by
    // ButtonItem
    final LinearLayout layout = (LinearLayout) view;
    layout.removeAllViews();

    for (ButtonItem buttonItem : mButtons) {
        Button button = buttonItem.createButton(layout);
        layout.addView(button);
    }

    view.setId(getViewId());
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:15,代码来源:ButtonBarItem.java

示例7: showStructBtn

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void showStructBtn(Context context, StructModel structModel, LinearLayout structBtnLineayLayout) {
    try {
        if (structModel.getButtons() != null && structModel.getButtons().size() > 0) {
            structBtnLineayLayout.removeAllViews();
            structBtnLineayLayout.setVisibility(View.VISIBLE);
            List<StructModel.ButtonsBean> buttonsBeens = structModel.getButtons();
            for (int i = 0; i < buttonsBeens.size(); i++) {
                StructModel.ButtonsBean buttonsBean = buttonsBeens.get(i);
                TextView textView = new TextView(context);
                textView.setText(buttonsBean.getText());
                textView.setOnClickListener(new MyStructBtnOnClick(buttonsBean));
                textView.setTextColor(context.getResources().getColor(R.color.udesk_custom_dialog_sure_btn_color));
                textView.setGravity(Gravity.CENTER);
                textView.setPadding(5, 5, 5, 5);
                textView.setTextSize(18);
                LinearLayout.LayoutParams textviewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT);

                View line = new View(context);
                line.setBackgroundColor(context.getResources().getColor(R.color.udesk_struct_bg_line_color));
                LinearLayout.LayoutParams lineParas = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                        1);
                structBtnLineayLayout.addView(textView, textviewParams);
                structBtnLineayLayout.addView(line, lineParas);
            }

        } else {
            structBtnLineayLayout.setVisibility(View.GONE);
        }
    } catch (Resources.NotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:lennyup,项目名称:react-native-udesk,代码行数:34,代码来源:MessageAdatper.java

示例8: initViews

import android.widget.LinearLayout; //导入方法依赖的package包/类
protected void initViews() {
    inflater = LayoutInflater.from(this);
    localViewContainer = (FrameLayout) findViewById(R.id.rc_local_user_view);
    remoteViewContainer = (LinearLayout) findViewById(R.id.rc_remote_user_container);
    remoteViewContainer1 = (LinearLayout) findViewById(R.id.rc_remote_user_container_1);
    remoteViewContainer2 = (LinearLayout) findViewById(R.id.rc_remote_user_container_2);
    topContainer = (LinearLayout) findViewById(R.id.rc_top_container);
    waitingContainer = (LinearLayout) findViewById(R.id.rc_waiting_container);
    bottomButtonContainer = (LinearLayout) findViewById(R.id.rc_bottom_button_container);
    participantPortraitContainer = (LinearLayout) findViewById(R.id.rc_participant_portait_container);
    minimizeButton = (ImageView) findViewById(R.id.rc_voip_call_minimize);
    addButton = (ImageView) findViewById(R.id.rc_voip_call_add);
    switchCameraButton = (ImageView) findViewById(R.id.rc_voip_switch_camera);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    remoteUserViewWidth = (metrics.widthPixels - 50) / 4;
    localView = null;
    localViewContainer.removeAllViews();
    remoteViewContainer1.removeAllViews();
    remoteViewContainer2.removeAllViews();

    minimizeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MultiVideoCallActivity.super.onMinimizeClick(v);
        }
    });
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:30,代码来源:MultiVideoCallActivity.java

示例9: displayPermissions

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * Utility method that displays permissions from a map containing group name and
 * list of permission descriptions.
 */
private void displayPermissions(List<MyPermissionGroupInfo> groups,
                                LinearLayout permListView, int which) {
    permListView.removeAllViews();

    int spacing = (int) (8 * context.getResources().getDisplayMetrics().density);

    for (MyPermissionGroupInfo grp : groups) {
        final List<MyPermissionInfo> perms = getPermissionList(grp, which);
        for (int j = 0; j < perms.size(); j++) {
            MyPermissionInfo perm = perms.get(j);
            View view = getPermissionItemView(grp, perm, j == 0,
                    which != WHICH_NEW ? newPermPrefix : null);
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
            if (j == 0) {
                lp.topMargin = spacing;
            }
            if (j == grp.allPermissions.size() - 1) {
                lp.bottomMargin = spacing;
            }
            if (permListView.getChildCount() == 0) {
                lp.topMargin *= 2;
            }
            permListView.addView(view, lp);
        }
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:33,代码来源:AppSecurityPermissions.java

示例10: setCountCircle

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void setCountCircle(LinearLayout linearLayout, int select, int count){
    linearLayout.removeAllViews();
    for(int i=0; i<count; i++){
        View view = new View(this);
        if(i == select){
            view.setBackgroundResource(R.drawable.tutorial_select_view_shape);
        }else{
            view.setBackgroundResource(R.drawable.tutorial_unselect_view_shape);
        }
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(32,32);
        params.setMargins(16,16,0,0);
        linearLayout.addView(view, params);
    }
}
 
开发者ID:DSM-GRAM,项目名称:Artist,代码行数:15,代码来源:TutorialActivity.java

示例11: renderEntity2

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void renderEntity2(BaseViewHolder helper, ItemEntity2 item) {
    helper.setImageResource(R.id.item_2_img, item.getImg());
    helper.setText(R.id.item_2_title, item.getTitle());
    helper.setText(R.id.item_2_content, item.getContent());
    helper.setText(R.id.item_2_price, item.getPrice());
    LinearLayout tagParent = helper.getView(R.id.item_2_tags);
    tagParent.removeAllViews();
    List<String> tags = item.getTags();
    for (String tag : tags) {
        SuperTextView view = (SuperTextView) mLayoutInflater.inflate(R.layout.label_tag, tagParent, false);
        view.setText(tag);
        tagParent.addView(view);
    }
}
 
开发者ID:crazysunj,项目名称:MultiTypeRecyclerViewAdapter,代码行数:15,代码来源:MyAdapter.java

示例12: addBottomDots

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void addBottomDots(int currentPage, LinearLayout ll_dots) {
    TextView[] dots = new TextView[slider_image_list.size()];
    ll_dots.removeAllViews();
    for (int i = 0; i < dots.length; i++) {
        dots[i] = new TextView(mContext);
        dots[i].setText(Html.fromHtml("&#8226;"));
        dots[i].setTextSize(35);
        dots[i].setTextColor(Color.parseColor("#343434"));
        ll_dots.addView(dots[i]);
    }

    if (dots.length > 0)
        dots[currentPage].setTextColor(Color.parseColor("#A2A2A2"));
}
 
开发者ID:mukesh4u,项目名称:RecyclerViewWIthMultipleViewType,代码行数:15,代码来源:MultiViewTypeAdapter.java

示例13: showChildEntityView

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void showChildEntityView(ArrayList<LightControlInterface> lightControlInterfaces, final View childEntityContainer, View lightControlView, int color) {

        childEntityViews.add(childEntityContainer);
        childEntityContainer.setVisibility(View.VISIBLE);

        LinearLayout childEntityView = (LinearLayout)childEntityContainer.findViewById(R.id.childEntityView);
        childEntityView.removeAllViews();

        ImageButton closeButton = (ImageButton)childEntityContainer.findViewById(R.id.closeButton);
        closeButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                hideChildEntityView(childEntityContainer);
            }
        });
        childEntityView.removeAllViews();

        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        lp.addRule(RelativeLayout.CENTER_IN_PARENT,1);
        for (LightControlInterface lightControlInterface : lightControlInterfaces) {

            View child = getLayoutInflater().inflate(R.layout.lightcontrol_list_item_small, null);
            TextView childText = (TextView)child.findViewById(R.id.buttonText);
            childText.setText(lightControlInterface.getName());

            try {
                String icon = lightControlInterface.getIcon();
                if (icon.length() > 0 && icon.substring(0, 4).equals("mdi:")) {

                    ImageView childImage = (ImageView)child.findViewById(R.id.buttonImage);
                    Drawable iconDrawable = thisActivity.getDrawable(getHassIconResource(lightControlInterface.getIcon()));
                    iconDrawable.setTint(getResources().getColor(R.color.white));
                    childImage.setBackground(iconDrawable);
                }
            } catch (Exception e) {
                Log.e("ChildEntityView", e.getMessage());
            }

            childEntityView.addView(child);
            setLightControlButton(lightControlInterface, child, childEntityContainer, lightControlView);
        }
    }
 
开发者ID:mervinderuiter,项目名称:home-assistant-android,代码行数:43,代码来源:Surface.java

示例14: makeGallerySwitch

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void makeGallerySwitch(LinearLayout gallerySwtichLayout, int count) {
    gallerySwtichLayout.removeAllViews();
    for (int i = 0; i < count; i++) {
        if (getActivity() != null) {
            ImageView itemImageView = new ImageView(getActivity());
            itemImageView.setLayoutParams(new LayoutParams(-2, -2));
            itemImageView.setImageResource(2130838158);
            itemImageView.setPadding(5, 0, 5, 0);
            gallerySwtichLayout.addView(itemImageView);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:TopRecommendFragment.java

示例15: showStandardCredits

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void showStandardCredits(StandardCredit standardCredit) {
    if (standardCredit != null) {
        String types[] = getContext().getResources().getStringArray(
                R.array.type_name);
        LinearLayout container = (LinearLayout) contentView
                .findViewById(R.id.container);
        container.removeAllViews();
        LinearLayout.LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        params.setMargins(10, 10, 10, 10);
        for (int i = 0; i < 8; i++) {
            TextView text = new TextView(getContext());
            text.setLayoutParams(params);
            text.setTextAppearance(getContext(),
                    android.R.style.TextAppearance_Medium);
            text.setTextColor(getContext().getResources().getColor(
                    R.color.darken));
            text.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
            if (i % 2 == 0) {
                text.setBackgroundResource(R.color.cloud);
            } else {
                text.setBackgroundResource(android.R.color.transparent);
            }
            text.setText(types[i] + ":"
                    + String.valueOf(standardCredit.getCredits().get(i)));
            container.addView(text);
        }
    }
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:30,代码来源:CreditStandardDialog.java


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