Java Code Examples for android.widget.LinearLayout.removeAllViews()

The following are Jave code examples for showing how to use removeAllViews() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: pvdisplay   File: LiveFragment.java   View Source Code Vote up 6 votes
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);
    }
}
 
Example 2
Project: pvdisplay   File: DailyFragment.java   View Source Code Vote up 6 votes
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);
    }
}
 
Example 3
Project: vollDeinBier   File: MainActivity.java   View Source Code Vote up 6 votes
@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);
    }
}
 
Example 4
Project: YCBaseAdapter   File: BaseStateCell.java   View Source Code Vote up 6 votes
@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);
}
 
Example 5
Project: odoo-work   File: ChatterView.java   View Source Code Vote up 6 votes
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);
    }
}
 
Example 6
Project: SetupWizardLibCompat   File: ButtonBarItem.java   View Source Code Vote up 6 votes
@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());
}
 
Example 7
Project: react-native-udesk   File: MessageAdatper.java   View Source Code Vote up 5 votes
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();
    }
}
 
Example 8
Project: sealtalk-android-master   File: MultiVideoCallActivity.java   View Source Code Vote up 5 votes
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);
        }
    });
}
 
Example 9
Project: mobile-store   File: AppSecurityPermissions.java   View Source Code Vote up 5 votes
/**
 * 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);
        }
    }
}
 
Example 10
Project: Artist   File: TutorialActivity.java   View Source Code Vote up 5 votes
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);
    }
}
 
Example 11
Project: MultiTypeRecyclerViewAdapter   File: MyAdapter.java   View Source Code Vote up 5 votes
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);
    }
}
 
Example 12
Project: RecyclerViewWIthMultipleViewType   File: MultiViewTypeAdapter.java   View Source Code Vote up 5 votes
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"));
}
 
Example 13
Project: home-assistant-android   File: Surface.java   View Source Code Vote up 5 votes
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);
        }
    }
 
Example 14
Project: FastAndroid   File: MultiVideoCallActivity.java   View Source Code Vote up 5 votes
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);
        }
    });
}
 
Example 15
Project: letv   File: TopRecommendFragment.java   View Source Code Vote up 5 votes
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);
        }
    }
}
 
Example 16
Project: TaipeiTechRefined   File: CreditStandardDialog.java   View Source Code Vote up 5 votes
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);
        }
    }
}
 
Example 17
Project: pius1   File: MaterialDialog.java   View Source Code Vote up 4 votes
public void setView(View view)
{
           LinearLayout l = (LinearLayout) mAlertDialogWindow.findViewById(R.id.contentView);
           l.removeAllViews();
           ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
	ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
           view.setLayoutParams(layoutParams);

           view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
	    @Override public void onFocusChange(View v, boolean hasFocus)
	    {
		mAlertDialogWindow.setSoftInputMode(
                           WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
		// show imm
		InputMethodManager imm = (InputMethodManager) mContext.getSystemService(
                           Context.INPUT_METHOD_SERVICE);
		imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
				    InputMethodManager.HIDE_IMPLICIT_ONLY);
	    }
	});

           l.addView(view);

           if (view instanceof ViewGroup)
    {

               ViewGroup viewGroup = (ViewGroup) view;

               for (int i = 0; i < viewGroup.getChildCount(); i++)
	{
                   if (viewGroup.getChildAt(i) instanceof EditText)
	    {
                       EditText editText = (EditText) viewGroup.getChildAt(i);
                       editText.setFocusable(true);
                       editText.requestFocus();
                       editText.setFocusableInTouchMode(true);
                   }
               }
               for (int i = 0; i < viewGroup.getChildCount(); i++)
	{
                   if (viewGroup.getChildAt(i) instanceof AutoCompleteTextView)
	    {
                       AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) viewGroup
		    .getChildAt(i);
                       autoCompleteTextView.setFocusable(true);
                       autoCompleteTextView.requestFocus();
                       autoCompleteTextView.setFocusableInTouchMode(true);
                   }
               }
           }
       }
 
Example 18
Project: boohee_v5.6   File: CopyRecordActivity.java   View Source Code Vote up 4 votes
private void initDietCardView(int time_type, ArrayList<RecordFood> foodRcordList,
                              LinearLayout ll_card) {
    RelativeLayout rl_meal = (RelativeLayout) ll_card.findViewById(R.id.rl_time_type);
    final ToggleButton tb_time_type = (ToggleButton) ll_card.findViewById(R.id.tb_time_type);
    TextView tv_time_type = (TextView) ll_card.findViewById(R.id.tv_time_type);
    LinearLayout ll_list = (LinearLayout) ll_card.findViewById(R.id.ll_list);
    if (foodRcordList == null || foodRcordList.size() == 0) {
        ll_card.setVisibility(8);
        if (time_type == 1) {
            this.breakfastCount = 0;
        } else if (time_type == 2) {
            this.lunchCount = 0;
        } else if (time_type == 3) {
            this.dinnerCount = 0;
        } else if (time_type == 6) {
            this.snacksBreakfastCount = 0;
        } else if (time_type == 7) {
            this.snacksLunchCount = 0;
        } else if (time_type == 8) {
            this.snacksDinnerCount = 0;
        }
    } else {
        ll_card.setVisibility(0);
        ll_list.removeAllViews();
        tb_time_type.setChecked(isDietChecked(foodRcordList));
        tv_time_type.setText(FoodUtils.getDietName(this, time_type));
        int totalCount = 0;
        for (int i = 0; i < foodRcordList.size(); i++) {
            if (((RecordFood) foodRcordList.get(i)).isChecked) {
                totalCount++;
            }
            View view = getDietItemView(time_type, foodRcordList, ll_card, i);
            if (view != null) {
                ll_list.addView(view);
            }
        }
        if (time_type == 1) {
            this.breakfastCount = totalCount;
        } else if (time_type == 2) {
            this.lunchCount = totalCount;
        } else if (time_type == 3) {
            this.dinnerCount = totalCount;
        } else if (time_type == 6) {
            this.snacksBreakfastCount = totalCount;
        } else if (time_type == 7) {
            this.snacksLunchCount = totalCount;
        } else if (time_type == 8) {
            this.snacksDinnerCount = totalCount;
        }
    }
    refreshCount();
    final ArrayList<RecordFood> arrayList = foodRcordList;
    final int i2 = time_type;
    final LinearLayout linearLayout = ll_card;
    rl_meal.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            tb_time_type.setChecked(!tb_time_type.isChecked());
            CopyRecordActivity.this.setDietAllIsChecked(arrayList, tb_time_type.isChecked());
            CopyRecordActivity.this.initDietCardView(i2, arrayList, linearLayout);
            if (tb_time_type.isChecked()) {
                CopyRecordActivity.this.tb_check_all.setChecked(CopyRecordActivity.this
                        .isAllChecked());
            } else {
                CopyRecordActivity.this.tb_check_all.setChecked(false);
            }
        }
    });
}
 
Example 19
Project: Tribe   File: OvSlideViewpager.java   View Source Code Vote up 4 votes
/**
 * 初始化viewpager
 */
private void initSlideViewPager(){
    if (mImageUrls==null||mImageUrls.size()<1){
        return;
    }
    //加载布局
    LayoutInflater inflater= LayoutInflater.from(context);
    View view = inflater.inflate(R.layout.slide_view_pager,this,true);
    mdotLayout= (LinearLayout)view.findViewById(R.id.ll_dot);
    mViewPager= (ViewPager) view.findViewById(R.id.viewpager_ad);
    mdotLayout.removeAllViews();

    //加载图片
    if (mOvLoader==null){
        throw new NullPointerException("mOvLoader==null");
    }
    //根据图片链接的个数初始化imageview个数
    mAllPage=new ImageView[mImageUrls.size()];
    for (int i=0;i<mImageUrls.size();i++){
        ImageView pageView=new ImageView(context);
        mAllPage[i]=pageView;//添加imageview
        pageView.setTag(R.id.AD_ImageView,i);
        pageView.setScaleType(ImageView.ScaleType.CENTER_CROP
        );//填充模式
        mOvLoader.displayImage(context,mImageUrls.get(i),pageView,
                ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
        pageView.setOnClickListener(this);//给每个View添加点击事件
    }

    if (isDisplayIndicator){
        //设置指示器
        drawPageIndicator();
    }

    PagerAdapter adapter=new OvSlideViewPagerAdapter();
    mViewPager.setAdapter(adapter);
    mViewPager.setFocusable(true);

    //动画
    if (pageTransformer != null) {
        mViewPager.setPageTransformer(true, pageTransformer);
    }
    //页面切换
    mViewPager.addOnPageChangeListener(new ADViewPagerChangeListener());


}
 
Example 20
Project: home-assistant-android   File: Surface.java   View Source Code Vote up 4 votes
public void hideChildEntityView(View childEntityContainer) {
    LinearLayout childEntityView = (LinearLayout)childEntityContainer.findViewById(R.id.childEntityView);
    childEntityView.removeAllViews();
    childEntityContainer.setVisibility(GONE);
}