本文整理了Java中android.widget.ImageButton.setOnClickListener()
方法的一些代码示例,展示了ImageButton.setOnClickListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.setOnClickListener()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:setOnClickListener
暂无
代码示例来源:origin: TeamNewPipe/NewPipe
private void buildControls() {
repeatButton = rootView.findViewById(R.id.control_repeat);
backwardButton = rootView.findViewById(R.id.control_backward);
playPauseButton = rootView.findViewById(R.id.control_play_pause);
forwardButton = rootView.findViewById(R.id.control_forward);
shuffleButton = rootView.findViewById(R.id.control_shuffle);
playbackSpeedButton = rootView.findViewById(R.id.control_playback_speed);
playbackPitchButton = rootView.findViewById(R.id.control_playback_pitch);
progressBar = rootView.findViewById(R.id.control_progress_bar);
repeatButton.setOnClickListener(this);
backwardButton.setOnClickListener(this);
playPauseButton.setOnClickListener(this);
forwardButton.setOnClickListener(this);
shuffleButton.setOnClickListener(this);
playbackSpeedButton.setOnClickListener(this);
playbackPitchButton.setOnClickListener(this);
}
代码示例来源:origin: stackoverflow.com
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.elv_group, null);
}
TextView tvItem = (TextView) convertView.findViewById(R.id.tvRecipeName);
ImageButton ibDeleteRcipe = (ImageButton) convertView.findViewById(R.id.ibDeleteRecipe);
ibDeleteRcipe.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
...
}
});
ibDeleteRcipe.setFocusable(false);
tvItem.setText(arrGroupElements[groupPosition]);
return convertView;
}
代码示例来源:origin: stackoverflow.com
useOtherCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
代码示例来源:origin: k9mail/k-9
public ClientCertificateSpinner(Context context, AttributeSet attrs) {
super(context, attrs);
if (context instanceof Activity) {
mActivity = (Activity) context;
} else {
Timber.e("ClientCertificateSpinner init failed! Please inflate with Activity!");
}
setOrientation(LinearLayout.HORIZONTAL);
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.client_certificate_spinner, this, true);
mSelection = findViewById(R.id.client_certificate_spinner_button);
mSelection.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
chooseCertificate();
}
});
mDeleteButton = findViewById(R.id.client_certificate_spinner_delete);
mDeleteButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onDelete();
}
});
}
代码示例来源:origin: facebook/facebook-android-sdk
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.rps_fragment, container, false);
gestureTextViews[ROCK] = (TextView) view.findViewById(R.id.text_rock);
gestureTextViews[PAPER] = (TextView) view.findViewById(R.id.text_paper);
gestureTextViews[SCISSORS] = (TextView) view.findViewById(R.id.text_scissors);
shootTextView = (TextView) view.findViewById(R.id.shoot);
playerChoiceView = (ImageView) view.findViewById(R.id.player_choice);
buyButton = (Button) view.findViewById(R.id.buy_button);
gestureImages[ROCK].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
gestureImages[PAPER].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
gestureImages[SCISSORS].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
fbButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
代码示例来源:origin: ankidroid/Anki-Android
ButtonVH(View itemView, ButtonItemAdapter adapter) {
super(itemView);
title = itemView.findViewById(R.id.card_browser_my_search_name_textview);
button = itemView.findViewById(R.id.card_browser_my_search_remove_button);
this.adapter = adapter;
itemView.setOnClickListener(this);
button.setOnClickListener(this);
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
private void init() {
dayPickerView = new SimpleDayPickerView(getContext(), controller);
addView(dayPickerView);
final LayoutInflater inflater = LayoutInflater.from(getContext());
final ViewGroup content = (ViewGroup) inflater.inflate(R.layout.mdtp_daypicker_group, this, false);
// Transfer all children from the content to this
while (content.getChildCount() > 0) {
final View view = content.getChildAt(0);
content.removeViewAt(0);
addView(view);
}
prevButton = findViewById(R.id.mdtp_previous_month_arrow);
nextButton = findViewById(R.id.mdtp_next_month_arrow);
if (controller.getVersion() == DatePickerDialog.Version.VERSION_1) {
int size = Utils.dpToPx(16f, getResources());
prevButton.setMinimumHeight(size);
prevButton.setMinimumWidth(size);
nextButton.setMinimumHeight(size);
nextButton.setMinimumWidth(size);
}
if (controller.isThemeDark()) {
int color = ContextCompat.getColor(getContext(), R.color.mdtp_date_picker_text_normal_dark_theme);
prevButton.setColorFilter(color);
nextButton.setColorFilter(color);
}
prevButton.setOnClickListener(this);
nextButton.setOnClickListener(this);
dayPickerView.setOnPageListener(this);
}
代码示例来源:origin: stackoverflow.com
ImageButton imageButton = (ImageButton) toolbar.findViewById(R.id.shareButton);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
代码示例来源:origin: stackoverflow.com
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar ab = getSherlock().getActionBar();
LayoutInflater li = LayoutInflater.from(this);
View customView = li.inflate(R.layout.my_custom_view, null);
ab.setCustomView(customView);
ImageButton ibItem1 = (ImageButton) customView.findViewById(R.id.item1);
ibItem1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// ...
}
});
ImageButton ibItem2 = (ImageButton) customView.findViewById(R.id.item2);
ibItem2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// ...
}
});
}
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void initViews(View rootView) {
super.initViews(rootView);
resizingIndicator = rootView.findViewById(R.id.resizing_indicator);
fullScreenButton = rootView.findViewById(R.id.fullScreenButton);
fullScreenButton.setOnClickListener(v -> onFullScreenButtonClicked());
videoPlayPause = rootView.findViewById(R.id.videoPlayPause);
extraOptionsView = rootView.findViewById(R.id.extraOptionsView);
closingOverlayView = rootView.findViewById(R.id.closingOverlay);
rootView.addOnLayoutChangeListener(this);
}
代码示例来源:origin: stackoverflow.com
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View V = inflater.inflate(R.layout.camera_fragment, container, false);
ImageButton camBt = (ImageButton)v.findViewById(R.id.button1);
camBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
});
return V;
}
代码示例来源:origin: stackoverflow.com
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageButton saldoButton = (ImageButton)findViewById(R.id.saldoButton);
saldoButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.d("This Class", "I am a working button!");
Intent intent = new Intent(this, NewClass.class);
this.startActivity(intent);
}
});
}
代码示例来源:origin: chentao0707/SimplifyReader
setOrientation(VERTICAL);
mProgressBar = (ProgressBar) LayoutInflater.from(context).inflate(R.layout.progress_horizontal, null);
mProgressBar.setMax(100);
mProgressBar.setProgress(0);
mBrowserControllerView = LayoutInflater.from(context).inflate(R.layout.browser_controller, null);
mGoBackBtn = (ImageButton) mBrowserControllerView.findViewById(R.id.browser_controller_back);
mGoForwardBtn = (ImageButton) mBrowserControllerView.findViewById(R.id.browser_controller_forward);
mGoBrowserBtn = (ImageButton) mBrowserControllerView.findViewById(R.id.browser_controller_go);
mRefreshBtn = (ImageButton) mBrowserControllerView.findViewById(R.id.browser_controller_refresh);
mGoBackBtn.setOnClickListener(new OnClickListener() {
mGoForwardBtn.setOnClickListener(new OnClickListener() {
mRefreshBtn.setOnClickListener(new OnClickListener() {
mGoBrowserBtn.setOnClickListener(new OnClickListener() {
代码示例来源:origin: pili-engineering/PLDroidPlayer
private void initControllerView(View v) {
mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
if (mPrevButton != null) {
mPrevButton.setVisibility(View.GONE);
mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
if (mNextButton != null) {
mNextButton.setVisibility(View.GONE);
mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
if (mFfwdButton != null) {
mFfwdButton.setOnClickListener(mFfwdListener);
if (!mFromXml) {
mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
if (mRewButton != null) {
mRewButton.setOnClickListener(mRewListener);
if (!mFromXml) {
mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
if (mPauseButton != null) {
mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);
代码示例来源:origin: stackoverflow.com
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_one, container, false);
ImageButton imgBtn = (ImageButton)view.findViewbyId(R.id.favorite);
imgBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Do your stuff
}
});
return view;
}
代码示例来源:origin: stackoverflow.com
ImageButton iv = view.findViewById(R.id.ivHello);
iv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//ImageButton is now clicked
}
});
代码示例来源:origin: k9mail/k-9
view = convertView;
} else {
view = getLayoutInflater().inflate(R.layout.accounts_item, parent, false);
holder.description = view.findViewById(R.id.description);
holder.email = view.findViewById(R.id.email);
holder.newMessageCount = view.findViewById(R.id.new_message_count);
holder.flaggedMessageCount = view.findViewById(R.id.flagged_message_count);
holder.newMessageCountWrapper = view.findViewById(R.id.new_message_count_wrapper);
} else {
holder.folders.setVisibility(View.VISIBLE);
holder.folders.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
FolderList.actionHandleAccount(Accounts.this, (Account)account);
代码示例来源:origin: HotBitmapGG/bilibili-android-client
private void initControllerView(View v) {
mPauseButton = (ImageButton) v.findViewById(R.id.media_controller_play_pause);
mTvPlay = (ImageView) v.findViewById(R.id.media_controller_tv_play);
if (mPauseButton != null && mTvPlay != null) {
mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);
mTvPlay.requestFocus();
mTvPlay.setOnClickListener(v13 -> {
});
mProgress = (SeekBar) v.findViewById(R.id.media_controller_seekbar);
if (mProgress != null) {
if (mProgress instanceof SeekBar) {
代码示例来源:origin: stackoverflow.com
private void addLevel(int index) {
LinearLayout mainActivityLayout = (LinearLayout)findViewById(R.id.ly_create_structure);
LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout ly = (LinearLayout) li.inflate(R.create_structure, null);
ImageButton ib = (ImageButton) ly.findViewById(R.id.add_level);
ib.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialog();
}
});
mainActivityLayout.addView(ly, index);
}
代码示例来源:origin: stackoverflow.com
ImageButton iv = (ImageButton) findViewById(R.id.resourceID);
iv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// code
}
});
内容来源于网络,如有侵权,请联系作者删除!