本文整理匯總了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();
}