本文整理汇总了Java中android.widget.ImageView.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setFocusable方法的具体用法?Java ImageView.setFocusable怎么用?Java ImageView.setFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setFocusable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: Image
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Creates a new Image component.
*
* @param container container, component will be placed in
*/
public Image(ComponentContainer container) {
super(container);
view = new ImageView(container.$context()) {
@Override
public boolean verifyDrawable(Drawable dr) {
super.verifyDrawable(dr);
// TODO(user): multi-image animation
return true;
}
};
view.setFocusable(true);
// Adds the component to its designated container
container.$add(this);
}
示例3: draw
import android.widget.ImageView; //导入方法依赖的package包/类
public void draw() {
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
Display deviceDisplay = windowManager.getDefaultDisplay();
Point point = new Point();
deviceDisplay.getSize(point);
deviceWidth = point.x;
deviceHeight = point.y;
imageView = new ImageView(this);
imageView.setClickable(false);
imageView.setFocusable(false);
imageView.setMinimumHeight(deviceHeight);
imageView.setMinimumWidth(deviceWidth);
drawKeylines();
}
示例4: 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);
}
示例5: 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);
}
示例6: addIcon
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* 添加图标
*/
private void addIcon(){
iconImageView = new ImageView(getContext());
iconImageView.setFocusable(false);
iconImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
iconImageView.setImageResource(iconResId);
int size = DimensUtils.dpToPx(getContext(),20);
LinearLayout.LayoutParams llp = new LayoutParams(size,size);
addView(iconImageView,llp);
}
示例7: onCreateView
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
mImageView = (ImageView) rootView.findViewById(R.id.image_content);
mImageView.setClickable(true);
mImageView.setFocusable(true);
mImageView.setImageResource(res);
return rootView;
}
示例8: getItemImageButton
import android.widget.ImageView; //导入方法依赖的package包/类
public static ImageView getItemImageButton(Context context, MenuObject item) {
ImageView imageView = new ImageButton(context);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
imageView.setLayoutParams(lp);
imageView.setPadding((int) context.getResources().getDimension(R.dimen.menu_item_padding),
(int) context.getResources().getDimension(R.dimen.menu_item_padding),
(int) context.getResources().getDimension(R.dimen.menu_item_padding),
(int) context.getResources().getDimension(R.dimen.menu_item_padding));
imageView.setClickable(false);
imageView.setFocusable(false);
imageView.setBackgroundColor(Color.TRANSPARENT);
if (item.getColor() != 0) {
Drawable color = new ColorDrawable(item.getColor());
imageView.setImageDrawable(color);
} else if (item.getResource() != 0) {
imageView.setImageResource(item.getResource());
} else if (item.getBitmap() != null) {
imageView.setImageBitmap(item.getBitmap());
} else if (item.getDrawable() != null) {
imageView.setImageDrawable(item.getDrawable());
}
imageView.setScaleType(item.getScaleType());
return imageView;
}
示例9: InfoBarLayout
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Constructs a layout for the specified infobar. After calling this, be sure to set the
* message, the buttons, and/or the custom content using setMessage(), setButtons(), and
* setCustomContent().
*
* @param context The context used to render.
* @param infoBarView InfoBarView that listens to events.
* @param iconResourceId ID of the icon to use for the infobar.
* @param iconBitmap Bitmap for the icon to use, if the resource ID wasn't passed through.
* @param message The message to show in the infobar.
*/
public InfoBarLayout(Context context, InfoBarView infoBarView, int iconResourceId,
Bitmap iconBitmap, CharSequence message) {
super(context);
mControlLayouts = new ArrayList<InfoBarControlLayout>();
mInfoBarView = infoBarView;
// Cache resource values.
Resources res = getResources();
mSmallIconSize = res.getDimensionPixelSize(R.dimen.infobar_small_icon_size);
mSmallIconMargin = res.getDimensionPixelSize(R.dimen.infobar_small_icon_margin);
mBigIconSize = res.getDimensionPixelSize(R.dimen.infobar_big_icon_size);
mBigIconMargin = res.getDimensionPixelSize(R.dimen.infobar_big_icon_margin);
mMarginAboveButtonGroup =
res.getDimensionPixelSize(R.dimen.infobar_margin_above_button_row);
mMarginAboveControlGroups =
res.getDimensionPixelSize(R.dimen.infobar_margin_above_control_groups);
mPadding = res.getDimensionPixelOffset(R.dimen.infobar_padding);
mMinWidth = res.getDimensionPixelSize(R.dimen.infobar_min_width);
mAccentColor = ApiCompatibilityUtils.getColor(res, R.color.infobar_accent_blue);
// Set up the close button. Apply padding so it has a big touch target.
mCloseButton = new ImageButton(context);
mCloseButton.setId(R.id.infobar_close_button);
mCloseButton.setImageResource(R.drawable.btn_close);
TypedArray a = getContext().obtainStyledAttributes(
new int [] {R.attr.selectableItemBackground});
Drawable closeButtonBackground = a.getDrawable(0);
a.recycle();
mCloseButton.setBackground(closeButtonBackground);
mCloseButton.setPadding(mPadding, mPadding, mPadding, mPadding);
mCloseButton.setOnClickListener(this);
mCloseButton.setContentDescription(res.getString(R.string.infobar_close));
mCloseButton.setLayoutParams(new LayoutParams(0, -mPadding, -mPadding, -mPadding));
// Set up the icon.
if (iconResourceId != 0 || iconBitmap != null) {
mIconView = new ImageView(context);
if (iconResourceId != 0) {
mIconView.setImageResource(iconResourceId);
} else if (iconBitmap != null) {
mIconView.setImageBitmap(iconBitmap);
}
mIconView.setLayoutParams(new LayoutParams(0, 0, mSmallIconMargin, 0));
mIconView.getLayoutParams().width = mSmallIconSize;
mIconView.getLayoutParams().height = mSmallIconSize;
mIconView.setFocusable(false);
}
// Set up the message view.
mMessageMainText = message;
mMessageLayout = new InfoBarControlLayout(context);
mMessageTextView = mMessageLayout.addMainMessage(prepareMainMessageString());
}