當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setSelected方法代碼示例

本文整理匯總了Java中android.widget.ImageView.setSelected方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setSelected方法的具體用法?Java ImageView.setSelected怎麽用?Java ImageView.setSelected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setSelected方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initDots

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * 初始化標識點
 *
 * @param length
 */
public void initDots(int length) {
    if (dotlayout == null)
        return;
    dotlayout.removeAllViews();
    LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(dip2px(context, dotsize), dip2px(context, dotsize));
    mParams.setMargins(dip2px(context, dotoffset), 0, dip2px(context, dotoffset), 0);//設置小圓點左右之間的間隔

    dotViews = new ImageView[length];

    for (int i = 0; i < length; i++) {
        ImageView imageView = new ImageView(context);
        imageView.setLayoutParams(mParams);
        imageView.setImageResource(R.drawable.dot_selector);
        if (i == 0) {
            imageView.setSelected(true);//默認啟動時,選中第一個小圓點
        } else {
            imageView.setSelected(false);
        }
        dotViews[i] = imageView;//得到每個小圓點的引用,用於滑動頁麵時,(onPageSelected方法中)更改它們的狀態。
        dotlayout.addView(imageView);//添加到布局裏麵顯示
    }
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:28,代碼來源:AdViewpagerUtil.java

示例2: addIconTab

import android.widget.ImageView; //導入方法依賴的package包/類
private void addIconTab(final int position, int resId) {
    ImageView tab = new ImageView(getContext()) {
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            if (pager.getAdapter() instanceof IconTabProvider) {
                ((IconTabProvider) pager.getAdapter()).customOnDraw(canvas, position);
            }
        }
    };
    tab.setFocusable(true);
    tab.setImageResource(resId);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:23,代碼來源:PagerSlidingTabStrip.java

示例3: setDaySelected

import android.widget.ImageView; //導入方法依賴的package包/類
private void setDaySelected(ImageView dayView, boolean b) {
    dayView.setSelected(b);
    String dayText = getDayText(dayView);
    int tag = (int) dayView.getTag();
    if (b) {
        dayView.setImageDrawable(selectedBuilder.build(dayText, selectedDayBackgroundColor));
        selectedDays.add(tag);
    } else {
        dayView.setImageDrawable(unselectedBuilder.build(dayText, unSelectedDayBackgroundColor));
        selectedDays.remove(tag);
    }
}
 
開發者ID:DavidProdinger,項目名稱:Weekdays-Selector,代碼行數:13,代碼來源:WeekdaysPicker.java

示例4: initHeadView

import android.widget.ImageView; //導入方法依賴的package包/類
private void initHeadView(ViewGroup topView,Data data) {
    topImage= (ImageView) topView.findViewById(R.id.head_image);
    listImageView= (ImageView) topView.findViewById(R.id.list_selector);
    gridImageView= (ImageView) topView.findViewById(R.id.grid_selector);
    text= (TextView) topView.findViewById(R.id.textView_info1);
    text.setText(data.getMember_share_tag().getDesc());
    String topImageth=data.getMember_share_tag().getImage_url();
    bitmapUtils.display(topImage,topImageth);
    listImageView.setSelected(true);
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:11,代碼來源:Info1Activity.java

示例5: addIconTab

import android.widget.ImageView; //導入方法依賴的package包/類
private void addIconTab(final int position, int resId) {
    ImageView tab = new ImageView(getContext());
    tab.setFocusable(true);
    tab.setImageResource(resId);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:15,代碼來源:PagerSlidingTabStrip.java

示例6: addIconTab

import android.widget.ImageView; //導入方法依賴的package包/類
public void addIconTab(int resId) {
    final int position = tabCount++;
    ImageView tab = new ImageView(getContext());
    tab.setFocusable(true);
    tab.setImageResource(resId);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            delegate.onPageSelected(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:16,代碼來源:ScrollSlidingTabStrip.java

示例7: onLocalAudioMuteClicked

import android.widget.ImageView; //導入方法依賴的package包/類
public void onLocalAudioMuteClicked(View view) {
    ImageView iv = (ImageView) view;
    if (iv.isSelected()) {
        iv.setSelected(false);
        iv.clearColorFilter();
    } else {
        iv.setSelected(true);
        iv.setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.MULTIPLY);
    }

    mRtcEngine.muteLocalAudioStream(iv.isSelected());
}
 
開發者ID:AgoraIO,項目名稱:Agora-Video-Source-Android,代碼行數:13,代碼來源:VideoChatViewActivity.java

示例8: onLocalViewHidden

import android.widget.ImageView; //導入方法依賴的package包/類
public void onLocalViewHidden(View view) {
    ImageView iv = (ImageView) view;
    if (iv.isSelected()) {
        iv.setSelected(false);
        iv.clearColorFilter();
        mCustomizedCameraRenderer.setViewHiddenStatus(false);
    } else {
        iv.setSelected(true);
        iv.setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.MULTIPLY);
        mCustomizedCameraRenderer.setViewHiddenStatus(true);
    }
}
 
開發者ID:AgoraIO,項目名稱:Agora-Video-Source-Android,代碼行數:13,代碼來源:VideoChatViewActivity.java

示例9: toggleLED

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Sets a clicked cell on/off.
 *
 * @param image An image of a clicked cell.
 * @param pos   Position of a clicked cell.
 * @return True, if cell is on and false otherwise.
 */
private boolean toggleLED(ImageView image, int pos) {
    boolean isOn;
    //Toast.makeText(this, "Pos :" +  pos, Toast.LENGTH_SHORT).show();
    int state = (Integer) image.getTag(R.id.ledState);
    if(state != 1) {
        DEVICE_CODE_ARRAY[pos] = 1;
        image.setBackground(getApplication().getResources().getDrawable(R.drawable.red_white_led_btn));
        image.setTag(R.id.ledState, 1);
        isOn = true;

    } else {
        DEVICE_CODE_ARRAY[pos] = 0;
        image.setBackground(getApplication().getResources().getDrawable(R.drawable.white_red_led_btn));
        image.setTag(R.id.ledState, 0);
        isOn = false;
        // Update the code to consider the still ON LED below the toggled one
        if(pos < 20) {
            DEVICE_CODE_ARRAY[pos + 5] = 1;
        }
    }

    image.setSelected(false);
    int position = (Integer) image.getTag(R.id.position);
    image.setContentDescription("" + position + getLEDStatus(pos));
    return isOn;
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:34,代碼來源:PairingActivity.java

示例10: onSwitchSpeakerphoneClicked

import android.widget.ImageView; //導入方法依賴的package包/類
public void onSwitchSpeakerphoneClicked(View view) {
    ImageView iv = (ImageView) view;
    if (iv.isSelected()) {
        iv.setSelected(false);
        iv.clearColorFilter();
    } else {
        iv.setSelected(true);
        iv.setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.MULTIPLY);
    }

    mRtcEngine.setEnableSpeakerphone(view.isSelected());
}
 
開發者ID:AgoraIO,項目名稱:Agora-Android-Voice-Tutorial-1to1,代碼行數:13,代碼來源:VoiceChatViewActivity.java

示例11: addPagerData

import android.widget.ImageView; //導入方法依賴的package包/類
public void addPagerData(PageBean bean, ViewPager viewPager){
    if (bean != null) {
        mCount = bean.datas.size();
        //這裏加小圓點
        LayoutParams params = new
                LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        params.setMargins(mLeftMargin,0,0,0);
        for (int i = 0; i < mCount; i++) {
            ImageView imageView = new ImageView(mContext);
            if (i == 0){
                imageView.setSelected(true);
            }else{
                imageView.setSelected(false);
            }
            imageView.setLayoutParams(params);
            imageView.setBackgroundResource(mSelector);

            addView(imageView);
        }

        if (viewPager != null) {
            viewPager.addOnPageChangeListener(this);
        }
    }
    if (bean.openview != null){
        mOpenView = bean.openview;
    }
}
 
開發者ID:LillteZheng,項目名稱:ViewPagerHelper,代碼行數:30,代碼來源:NormalIndicator.java


注:本文中的android.widget.ImageView.setSelected方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。