本文整理汇总了Java中android.widget.ImageButton.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ImageButton.setEnabled方法的具体用法?Java ImageButton.setEnabled怎么用?Java ImageButton.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageButton
的用法示例。
在下文中一共展示了ImageButton.setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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;
}
示例3: onCreateView
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_save, container, false);
view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));
mCancel = (ImageButton) view.findViewById(android.R.id.button2);
mCancel.setOnClickListener(this);
mDisplayName = (EditText) view.findViewById(android.R.id.title);
mDisplayName.addTextChangedListener(mDisplayNameWatcher);
mDisplayName.setText(getArguments().getString(EXTRA_DISPLAY_NAME));
mSave = (ImageButton) view.findViewById(android.R.id.button1);
mSave.setOnClickListener(this);
mSave.setEnabled(false);
mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
return view;
}
示例4: 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);
}
示例5: onCreate
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_detail);
// Get post key from intent
mPostKey = getIntent().getStringExtra(EXTRA_POST_KEY);
if (mPostKey == null) {
throw new IllegalArgumentException("Must pass EXTRA_POST_KEY");
}
// Initialize Database
mPostReference = FirebaseDatabase.getInstance().getReference()
.child("posts").child(mPostKey);
mCommentsReference = FirebaseDatabase.getInstance().getReference()
.child("post-comments").child(mPostKey);
// Initialize Views
mAuthorView = (TextView) findViewById(R.id.post_author);
mTitleView = (TextView) findViewById(R.id.post_title);
mBodyView = (TextView) findViewById(R.id.post_body);
mCommentField = (EditText) findViewById(R.id.field_comment_text);
mCommentButton = (ImageButton) findViewById(R.id.button_post_comment);
mCommentButton.setEnabled(false);
if (mCommentField.getText() != null){
mCommentButton.setEnabled(true);
mCommentButton.setImageResource(R.drawable.ic_foursquare_button);
}
mCommentsRecycler = (RecyclerView) findViewById(R.id.recycler_comments);
detailedPicture = (ImageView)findViewById(R.id.post_author_photo);
mCommentButton.setOnClickListener(this);
mCommentsRecycler.setLayoutManager(new LinearLayoutManager(this));
authorImage = (ImageView)findViewById(R.id._author_photo);
authorName = (TextView)findViewById(R.id.author_name);
authorJob = (TextView)findViewById(R.id.author_job_title);
aboutTheAuthor = (TextView)findViewById(R.id.author_description_);
numberOfParticipants = (TextView)findViewById(R.id.number_of_participants);
timeStampText = (TextView)findViewById(R.id.the_real_fucking_time);
}
示例6: handleMessage
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case PROCESS_DEFINITION_LIST:
showSearchButton();
List<Definition> definitionList = (List<Definition>) msg.obj;
processDefinitionList(definitionList);
break;
case ASYNC_SEARCH_FAILED:
showSearchButton();
Toast.makeText(PopupActivity.this, (String) msg.obj, Toast.LENGTH_LONG).show();
break;
case SET_ADDED:
progressDialog.hide();
ImageButton btn = (ImageButton) msg.obj;
btn.setBackgroundResource(R.drawable.ic_add_grey);
btn.setEnabled(false);
Toast.makeText(PopupActivity.this, R.string.term_added, Toast.LENGTH_SHORT).show();
break;
case SET_ADD_FAILED:
progressDialog.hide();
String message = (String) msg.obj;
Toast.makeText(PopupActivity.this, message, Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
示例7: onCreateView
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_playback_controls, container, false);
mPlayPause = (ImageButton) rootView.findViewById(R.id.play_pause);
mPlayPause.setEnabled(true);
mPlayPause.setOnClickListener(mButtonListener);
audioSeekBar = (SeekBar) rootView.findViewById(R.id.seekBar);
mTitle = (TextView) rootView.findViewById(R.id.title);
mSubtitle = (TextView) rootView.findViewById(R.id.artist);
mExtraInfo = (TextView) rootView.findViewById(R.id.extra_info);
mAlbumArt = (ImageView) rootView.findViewById(R.id.album_art);
init();
rootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<MusicMedia> songList = MediaUtil.getInstacen().getSongList();
Log.i(TAG,"songList="+songList.size());
if(songList.size()>0){
Intent playIntent = new Intent(getActivity(), FullScreenPlayerActivity.class);
playIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
if(MediaUtil.CURRENTPOS<0){
Toast.makeText(getActivity(),R.string.select_yinpin,0).show();
return;
}
playIntent.putExtra("music",songList.get(MediaUtil.CURRENTPOS));
startActivity(playIntent);
}else{
Toast.makeText(getActivity(),R.string.select_yinpin,0).show();
}
// playIntent.putExtra("position", position);
}
});
return rootView;
}
示例8: afterTextChanged
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
ImageButton btnSend = (ImageButton) findViewById(R.id.btnSendMsg);
if(s.length() > 0) {
btnSend.setEnabled(true);
} else {
btnSend.setEnabled(false);
}
}
示例9: getCurrentPage
import android.widget.ImageButton; //导入方法依赖的package包/类
public void getCurrentPage() {
LinearLayout noServersError = (LinearLayout) findViewById(R.id.errorMessage_noEnabledServers);
noServersError.setVisibility(View.GONE);
KRFAM.log("MainActivity.java > getCurrentPage");
TextView searchBox = (TextView) findViewById(R.id.search_editText);
Switch searchAll = (Switch) findViewById(R.id.allFolders_Switch);
ImageButton nextPButton = (ImageButton) findViewById(R.id.nextPage_Button);
ImageButton prevPButton = (ImageButton) findViewById(R.id.prevPage_Button);
TextView pageInfo = (TextView) findViewById(R.id.pageInfo_textView);
int accountTotal = db.countAccounts(CURRENT_FOLDER, searchBox.getText().toString(), searchAll.isChecked());
int pageTotal = (accountTotal - 1) / KRFAM.MAX_DISPLAY + 1;
int displayTop = (1 + CURRENT_OFFSET + KRFAM.MAX_DISPLAY);
if (displayTop >= accountTotal + 1) {
displayTop = accountTotal + 1;
nextPButton.setEnabled(false);
} else {
nextPButton.setEnabled(true);
}
if (CURRENT_OFFSET <= 0) {
CURRENT_OFFSET = 0;
prevPButton.setEnabled(false);
} else {
prevPButton.setEnabled(true);
}
pageInfo.setText("Page " + ((CURRENT_OFFSET / KRFAM.MAX_DISPLAY) + 1) + " of " + pageTotal + "\n" + (1 + CURRENT_OFFSET) + "- " + (displayTop - 1) + " of " + accountTotal);
ACCOUNT_LIST_DATA = db.getAccounts(CURRENT_FOLDER, KRFAM.MAX_DISPLAY, CURRENT_OFFSET, KRFAM.SORT_BY, KRFAM.REVERSE_SORT, searchBox.getText().toString(), searchAll.isChecked());
if (ACCOUNT_LIST_DATA == null) {
noServersError.setVisibility(View.VISIBLE);
if (CURRENT_FOLDER != -1) {
changeFolder(-1);
}
} else {
ACCOUNT_LIST_ADAPTER = new AccountListAdapter(MainActivity.this, R.layout.account_list, ACCOUNT_LIST_DATA);
ACCOUNT_LIST.setAdapter(ACCOUNT_LIST_ADAPTER);
}
}
示例10: buildBottomBarButton
import android.widget.ImageButton; //导入方法依赖的package包/类
/**
* Builds an {@link ImageButton} from the data in this params. Generated buttons should be
* placed on the bottom bar. The button's tag will be its id.
* @param parent The parent that the inflated {@link ImageButton}.
* @param listener {@link OnClickListener} that should be used with the button.
* @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
*/
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
if (mIsOnToolbar) return null;
ImageButton button = (ImageButton) LayoutInflater.from(context)
.inflate(R.layout.custom_tabs_bottombar_item, parent, false);
button.setId(mId);
button.setImageBitmap(mIcon);
button.setContentDescription(mDescription);
if (mPendingIntent == null) {
button.setEnabled(false);
} else {
button.setOnClickListener(listener);
}
button.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
final int[] screenPos = new int[2];
view.getLocationOnScreen(screenPos);
final int width = view.getWidth();
Toast toast = Toast.makeText(
view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM | Gravity.END,
screenWidth - screenPos[0] - width / 2,
screenHeight - screenPos[1]);
toast.show();
return true;
}
});
return button;
}
示例11: setImageButtonEnabled
import android.widget.ImageButton; //导入方法依赖的package包/类
public static void setImageButtonEnabled(Context ctxt, boolean enabled, ImageButton item,
int iconResId) {
item.setEnabled(enabled);
Drawable originalIcon = ctxt.getResources().getDrawable(iconResId);
Drawable icon = enabled ? originalIcon : convertDrawableToGrayScale(originalIcon);
item.setImageDrawable(icon);
}
示例12: initGenderButton
import android.widget.ImageButton; //导入方法依赖的package包/类
private ImageButton initGenderButton(final String gender, int buttonId) {
boolean selected = gender.equals(mSpecimen.gender);
ImageButton button = (ImageButton) findViewById(buttonId);
button.setEnabled(mEditMode);
button.setSelected(selected);
updateGenderIconFilter(button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (v.isSelected()) {
//Deselect existing
deselectAllGenderButtons();
mSpecimen.gender = null;
} else {
//Select this one
deselectAllGenderButtons();
v.setSelected(true);
mSpecimen.gender = gender;
}
updateGenderIconFilter((ImageButton) v);
}
});
return button;
}
示例13: getView
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Project project = mProjects.get(position);
if(convertView == null) {
LayoutInflater inflater = LayoutInflater.from(MBApp.getApp());
convertView = inflater.inflate(R.layout.project_items, null);
}
Button appNameButton = (Button) convertView.findViewById(R.id.appNameButton);
appNameButton.setTypeface(MBApp.getApp().getRobotoTypeface());
ExtendedEditText appNameEdit = (ExtendedEditText) convertView.findViewById(R.id.appNameEdit);
appNameEdit.setTypeface(MBApp.getApp().getRobotoTypeface());
LinearLayout actionBarLayout = (LinearLayout) convertView.findViewById(R.id.actionBarForProgram);
if(actionBarLayout != null) {
if(project.actionBarExpanded) {
actionBarLayout.setVisibility(View.VISIBLE);
appNameButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(MBApp.getApp()
, R.drawable.ic_arrow_down), null);
} else {
actionBarLayout.setVisibility(View.GONE);
appNameButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(MBApp.getApp()
, R.drawable.ic_arrow_left), null);
}
}
appNameButton.setText(project.name);
appNameButton.setTag(R.id.positionId, position);
appNameButton.setTag(R.id.textEdit, appNameEdit);
appNameButton.setOnClickListener(appNameClickListener);
appNameButton.setOnLongClickListener(appNameLongClickListener);
appNameEdit.setTag(R.id.positionId, position);
appNameEdit.setTag(R.id.editbutton, appNameButton);
appNameEdit.setOnEditorActionListener(editorOnActionListener);
appNameEdit.setFilters(new InputFilter[]{renameFilter});
if(project.inEditMode) {
appNameEdit.setVisibility(View.VISIBLE);
appNameEdit.setText(project.name);
appNameEdit.setSelection(project.name.length());
appNameEdit.requestFocus();
appNameButton.setVisibility(View.INVISIBLE);
} else {
appNameEdit.setVisibility(View.INVISIBLE);
appNameButton.setVisibility(View.VISIBLE);
//dismissKeyBoard(appNameEdit, false);
}
//appNameEdit.setOnClickListener(appNameClickListener);
TextView flashBtnText = (TextView) convertView.findViewById(R.id.project_item_text);
flashBtnText.setTypeface(MBApp.getApp().getRobotoTypeface());
LinearLayout sendBtnLayout = (LinearLayout) convertView.findViewById(R.id.sendBtn);
sendBtnLayout.setTag(position);
sendBtnLayout.setOnClickListener(sendBtnClickListener);
ImageButton deleteBtn = (ImageButton) convertView.findViewById(R.id.deleteBtn);
deleteBtn.setTag(position);
deleteBtn.setOnClickListener(deleteBtnClickListener);
deleteBtn.setEnabled(true);
Drawable myIcon;
if(project.runStatus) {
flashBtnText.setText("");
myIcon = convertView.getResources().getDrawable(R.drawable.green_btn);
} else {
flashBtnText.setText(R.string.flash);
myIcon = convertView.getResources().getDrawable(R.drawable.blue_btn);
}
sendBtnLayout.setBackground(myIcon);
sendBtnLayout.setClickable(true);
return convertView;
}
示例14: setButtonEnabled
import android.widget.ImageButton; //导入方法依赖的package包/类
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
示例15: setButtonEnabled
import android.widget.ImageButton; //导入方法依赖的package包/类
protected void setButtonEnabled(ImageButton b, boolean isEnabled)
{
b.setEnabled(isEnabled);
ViewUtils.setImageButtonColorAttr(getContext(), b,
b.isEnabled() ? R.attr.colorDialogContent : R.attr.colorDialogDisabledElement);
}