本文整理汇总了Java中android.widget.ImageButton类的典型用法代码示例。如果您正苦于以下问题:Java ImageButton类的具体用法?Java ImageButton怎么用?Java ImageButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageButton类属于android.widget包,在下文中一共展示了ImageButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNavigationMenuItem
import android.widget.ImageButton; //导入依赖的package包/类
/**
* Returns the menu item, which shows the navigation icon of the tab switcher's toolbar.
*
* @return The menu item, which shows the navigation icon of the tab switcher's toolbar, as an
* instance of the class {@link View} or null, if no navigation icon is shown
*/
@Nullable
private View getNavigationMenuItem() {
Toolbar[] toolbars = tabSwitcher.getToolbars();
if (toolbars != null) {
Toolbar toolbar = toolbars.length > 1 ? toolbars[1] : toolbars[0];
int size = toolbar.getChildCount();
for (int i = 0; i < size; i++) {
View child = toolbar.getChildAt(i);
if (child instanceof ImageButton) {
return child;
}
}
}
return null;
}
示例2: setNumberKey
import android.widget.ImageButton; //导入依赖的package包/类
private void setNumberKey(ImageButton buttonView, int key) {
Drawable tempDrawable = null;
if (null != mNumForeSelectorArray[key]) {
tempDrawable = mNumForeSelectorArray[key].getConstantState()
.newDrawable();
buttonView.setImageDrawable(tempDrawable);
}
if (null != mNumBgSelectorArray
&& null != mNumBgSelectorArray[key]) {
tempDrawable = mNumBgSelectorArray[key].getConstantState()
.newDrawable();
buttonView.setBackgroundDrawable(tempDrawable);
} else if (null != mNumBgDrawSelector) {
tempDrawable = mNumBgDrawSelector.getConstantState()
.newDrawable();
buttonView.setBackgroundDrawable(tempDrawable);
}
}
示例3: addRowToNumbersList
import android.widget.ImageButton; //导入依赖的package包/类
private boolean addRowToNumbersList(@NonNull String number, int type) {
// create and add the new row
LayoutInflater inflater = getActivity().getLayoutInflater();
View row = inflater.inflate(R.layout.row_contact_number, numbersViewList, false);
numbersViewList.addView(row);
// init row with number data
setNumberType(row, type);
setNumber(row, number);
// init 'row remove' button
ImageButton buttonRemove = (ImageButton) row.findViewById(R.id.button_remove);
buttonRemove.setTag(row);
buttonRemove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
numbersViewList.removeView((View) v.getTag());
}
});
// scroll list down
moveScroll();
return true;
}
示例4: initViews
import android.widget.ImageButton; //导入依赖的package包/类
private void initViews() {
btnPublish = (ImageButton) findViewById(R.id.publish);
btnSwitch = (ImageButton) findViewById(R.id.swCam);
btnBack = (ImageButton) findViewById(R.id.back);
txtState = (TextView) findViewById(R.id.state);
mCameraView = (SurfaceView) findViewById(R.id.preview);
mMessagesView = (RecyclerView) findViewById(R.id.push_messages_receive_layout);
linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setStackFromEnd(true);
mMessagesView.setLayoutManager(linearLayoutManager);
mMessagesView.setAdapter(mAdapter);
mCameraView.getHolder().addCallback(this);
btnPublish.setOnClickListener(this);
btnSwitch.setOnClickListener(this);
btnBack.setOnClickListener(this);
}
示例5: setOkButton
import android.widget.ImageButton; //导入依赖的package包/类
public static void setOkButton(final BaseActivity activity, int resource) {
TextView tvOk = (TextView) activity.findViewById(R.id.tv_right);
ImageButton btnOk = (ImageButton) activity.findViewById(R.id.btn_right);
if (btnOk != null) {
tvOk.setVisibility(View.GONE);
if (resource != 0) {
btnOk.setImageDrawable(activity.getResources().getDrawable(resource));
}
btnOk.setVisibility(View.VISIBLE);
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.onOkButtonClick();
}
});
}
}
示例6: showSearchInterfaceBar
import android.widget.ImageButton; //导入依赖的package包/类
private void showSearchInterfaceBar(String text) {
LightningView wv=getCurrentWebView();
if(wv==null){
return;
}
mSearchBar = (RelativeLayout) findViewById(R.id.search_bar);
mSearchBar.setVisibility(View.VISIBLE);
TextView tw = (TextView) findViewById(R.id.search_query);
tw.setText("'" + text + "'");
ImageButton up = (ImageButton) findViewById(R.id.button_next);
up.setOnClickListener(this);
ImageButton down = (ImageButton) findViewById(R.id.button_back);
down.setOnClickListener(this);
ImageButton quit = (ImageButton) findViewById(R.id.button_quit);
quit.setOnClickListener(this);
}
示例7: findViewsAndAssign
import android.widget.ImageButton; //导入依赖的package包/类
private void findViewsAndAssign() {
// find views for station name and image and playback indicator
mStationNameView = (TextView) mRootView.findViewById(R.id.player_textview_stationname);
mtxtDescriptionView = (TextView) mRootView.findViewById(R.id.txtDescription);
mtxtMarkdownDescriptionView = (TextView) mRootView.findViewById(R.id.txtMarkdownDescription);
mRatingBarView = (RatingBar) mRootView.findViewById(R.id.ratingBar);
mStationMetadataView = (TextView) mRootView.findViewById(R.id.player_textview_station_metadata);
mPlaybackIndicator = (ImageView) mRootView.findViewById(R.id.player_playback_indicator);
mPlaybackButton = (ImageButton) mRootView.findViewById(R.id.player_playback_button);
mPlayerFavoritButton = (ImageButton) mRootView.findViewById(R.id.player_item_favorit_button);
mStationImageView = (SimpleDraweeView) mRootView.findViewById(R.id.player_imageview_station_icon);
mStationMenuView = (ImageButton) mRootView.findViewById(R.id.player_item_more_button);
mCrdMarkdownDescriptionView = (CardView) mRootView.findViewById(R.id.crdMarkdownDescription);
mRelLayLargeButtonPlayView = (RelativeLayout) mRootView.findViewById(R.id.relLayLargeButtonPlay);
}
示例8: initViews
import android.widget.ImageButton; //导入依赖的package包/类
void initViews() {
container = (ViewGroup) activity.findViewById(R.id.play_list_hide_bar);
hidePlayListBar = (ImageButton) activity.findViewById(R.id.play_list_hide);
playMode = (ImageButton) activity.findViewById(R.id.play_mode);
playFavorite = (ImageButton) activity.findViewById(R.id.play_favorite);
playShowList = (ImageButton) activity.findViewById(R.id.play_show_list);
playShowMore = (ImageButton) activity.findViewById(R.id.play_show_more);
hidePlayListBar.setOnClickListener(this);
playMode.setOnClickListener(this);
container.setOnClickListener(this);
playFavorite.setOnClickListener(this);
playShowList.setOnClickListener(this);
playShowMore.setOnClickListener(this);
mDialog.setOnItemClickListener(this);
}
示例9: getView
import android.widget.ImageButton; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if(convertView == null){
holder = new ViewHolder();
convertView = getActivity().getLayoutInflater().inflate(R.layout.listitem_active_app, parent, false);
holder.tv_appName = (TextView) convertView.findViewById(R.id.tv_appName);
holder.ib_removeApp = (ImageButton) convertView.findViewById(R.id.ib_removeApp);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tv_appName.setText(appList.get(position).getAppName());
holder.ib_removeApp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
devicesHandler.removeApp(devicesHandler.getCurrentDeviceProfileID(), appList.get(position).getID());
}
});
return convertView;
}
示例10: onCreateView
import android.widget.ImageButton; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//final Context context = inflater.getContext();
final View view = inflater.inflate(R.layout.fragment_move, container, false);
view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));
mCancel = (ImageButton) view.findViewById(android.R.id.button2);
mCancel.setOnClickListener(this);
mMoveInfo = (TextView) view.findViewById(android.R.id.title);
mMoveInfo.setText("Paste " + FileUtils.formatFileCount(docs.size()) + " in ");
mMoveInfo.setEnabled(false);
mRootInfo = (TextView) view.findViewById(android.R.id.text1);
mSave = (ImageButton) view.findViewById(android.R.id.button1);
mSave.setOnClickListener(this);
mSave.setEnabled(false);
mProgress = (MaterialProgressBar) view.findViewById(android.R.id.progress);
mProgress.setColor(SettingsActivity.getAccentColor());
return view;
}
示例11: showShortenedUrl
import android.widget.ImageButton; //导入依赖的package包/类
private void showShortenedUrl(){
// Setting up Variables for Layout
final TextView viewShortenedUrl = (TextView) findViewById(R.id.textViewShortenedLink);
final ImageButton shareButton = (ImageButton) findViewById(R.id.shareButton);
final ImageButton openLinkButton = (ImageButton) findViewById(R.id.openLinkButton);
final ImageButton copyLinkButton = (ImageButton) findViewById(R.id.copyLinkButton);
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
final ImageButton qrCodeButton = (ImageButton) findViewById(R.id.qrCodeButton);
// We set the shortened URL as Label
viewShortenedUrl.setText(shortUrl);
// Now we hide the loading-spinner and set the Buttons and Texts as vissible
progressBar.setVisibility(View.GONE);
viewShortenedUrl.setVisibility(View.VISIBLE);
shareButton.setVisibility(View.VISIBLE);
openLinkButton.setVisibility(View.VISIBLE);
copyLinkButton.setVisibility(View.VISIBLE);
qrCodeButton.setVisibility(View.VISIBLE);
}
示例12: createListenerSubmitButton
import android.widget.ImageButton; //导入依赖的package包/类
@Override
protected void createListenerSubmitButton(ImageButton submit) {
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try
{
double value=Double.parseDouble(txtValue.getText().toString());
//check if the entry is valide (range)
if (!Validator.isEntryValueValide(Const.CATEGORY_GLUCOSE,value))
{
CustomToast.getInstance().errorTOast(getString(R.string.incorrect_value),getActivity());
return;
}
homeActivity.sendValue(Const.CATEGORY_GLUCOSE,value+"");
dismiss();
}
catch (Exception ex)
{
CustomToast.getInstance().errorTOast(getString(R.string.incorrect_value),getActivity());
}
}
});
}
示例13: internalOnCreate
import android.widget.ImageButton; //导入依赖的package包/类
@Override
protected void internalOnCreate(Bundle savedInstanceState) {
totalText = (TextView)findViewById(R.id.total);
filterText = (TextView)findViewById(R.id.period);
ImageButton bFilter = (ImageButton) findViewById(R.id.bFilter);
bFilter.setImageResource(R.drawable.ic_menu_filter_on);
bFilter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showFilter();
}
});
loadFilter();
setupFilter();
}
示例14: initSendMessage
import android.widget.ImageButton; //导入依赖的package包/类
private void initSendMessage() {
etMessage = findViewById(R.id.inputMessage);
ImageButton sendButton = findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendMessage();
}
});
if (ctype == Chat.ChatType.GROUP && !Utils.getController().getMessengerDatabase().userInChat(Utils.getUserID(), cid)) {
etMessage.setEnabled(false);
etMessage.setHint("Du bist nicht in diesem Chat!");
sendButton.setEnabled(false);
}
}
示例15: onBindViewHolder
import android.widget.ImageButton; //导入依赖的package包/类
@Override
public void onBindViewHolder(final StudyAdapter.Holder holder, final int position) {
TaskItem item = mFeedItemList.get(position);
TextView textView = holder.textView;
textView.setText(item.getTaskName());
ImageButton imgBtn = holder.markDoneBtn;
TooltipCompat.setTooltipText(imgBtn, "Mark as done");
// imgBtn.setTooltipText() = TooltipCompat.setTooltipText();
// imgBtn.setTooltipText(test);
imgBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
notifyItemRemoved(position);
mFeedItemList.remove(position);
Snackbar.make(view, "Task marked as done.", 6000).show();
}
});
}