本文整理汇总了Java中android.widget.ImageButton.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java ImageButton.setFocusable方法的具体用法?Java ImageButton.setFocusable怎么用?Java ImageButton.setFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageButton
的用法示例。
在下文中一共展示了ImageButton.setFocusable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindView
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onBindView(View view) {
super.onBindView(view);
LinearLayout widgetFrameView = ((LinearLayout) view.findViewById(android.R.id.widget_frame));
mBtnAppIcon = new ImageButton(mContext);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mAppIconPreviewSizePx, mAppIconPreviewSizePx);
lp.gravity = Gravity.CENTER;
mBtnAppIcon.setLayoutParams(lp);
mBtnAppIcon.setScaleType(ScaleType.CENTER_CROP);
mBtnAppIcon.setImageDrawable(mAppInfo.icon);
mBtnAppIcon.setFocusable(false);
if (mIconPickerEnabled) {
mBtnAppIcon.setOnClickListener(this);
mBtnAppIcon.setOnLongClickListener(this);
} else {
mBtnAppIcon.setEnabled(false);
}
widgetFrameView.addView(mBtnAppIcon);
widgetFrameView.setVisibility(View.VISIBLE);
}
示例2: initView
import android.widget.ImageButton; //导入方法依赖的package包/类
private void initView(View view) {
tv = (ImageButton) view.findViewById(R.id.local_tv);
tour = (ImageButton) view.findViewById(R.id.local_tour);
ad1 = (ImageButton) view.findViewById(R.id.local_ad1);
ad2 = (ImageButton) view.findViewById(R.id.local_ad2);
cate = (ImageButton) view.findViewById(R.id.local_cate);
weather = (ImageButton) view.findViewById(R.id.local_weather);
news = (ImageButton) view.findViewById(R.id.local_news);
appStore = (ImageButton) view.findViewById(R.id.local_app_store);
video = (ImageButton) view.findViewById(R.id.local_video);
tv.setOnFocusChangeListener(mFocusChangeListener);
tour.setOnFocusChangeListener(mFocusChangeListener);
ad1.setOnFocusChangeListener(mFocusChangeListener);
ad2.setOnFocusChangeListener(mFocusChangeListener);
cate.setOnFocusChangeListener(mFocusChangeListener);
weather.setOnFocusChangeListener(mFocusChangeListener);
news.setOnFocusChangeListener(mFocusChangeListener);
appStore.setOnFocusChangeListener(mFocusChangeListener);
video.setOnFocusChangeListener(mFocusChangeListener);
tv.setOnClickListener(this);
video.setOnClickListener(this);
tv.setFocusable(true);
tv.setFocusableInTouchMode(true);
tv.requestFocus();
tv.requestFocusFromTouch();
}