本文整理汇总了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;
}
}