本文整理匯總了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);//添加到布局裏麵顯示
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
}
示例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;
}
示例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());
}
示例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;
}
}