当前位置: 首页>>代码示例>>Java>>正文


Java ImageButton.setOnLongClickListener方法代码示例

本文整理汇总了Java中android.widget.ImageButton.setOnLongClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java ImageButton.setOnLongClickListener方法的具体用法?Java ImageButton.setOnLongClickListener怎么用?Java ImageButton.setOnLongClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageButton的用法示例。


在下文中一共展示了ImageButton.setOnLongClickListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onFinishInflate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    setBackground(new ColorDrawable(
            ApiCompatibilityUtils.getColor(getResources(), R.color.default_primary_color)));
    mUrlBar = (UrlBar) findViewById(R.id.url_bar);
    mUrlBar.setHint("");
    mUrlBar.setDelegate(this);
    mUrlBar.setEnabled(false);
    mUrlBar.setAllowFocus(false);
    mTitleBar = (TextView) findViewById(R.id.title_bar);
    mLocationBarFrameLayout = findViewById(R.id.location_bar_frame_layout);
    mTitleUrlContainer = findViewById(R.id.title_url_container);
    mTitleUrlContainer.setOnLongClickListener(this);
    mSecurityButton = (TintedImageButton) findViewById(R.id.security_button);
    mSecurityIconType = ConnectionSecurityLevel.NONE;
    mCustomActionButton = (ImageButton) findViewById(R.id.action_button);
    mCustomActionButton.setOnLongClickListener(this);
    mCloseButton = (ImageButton) findViewById(R.id.close_button);
    mCloseButton.setOnLongClickListener(this);
    mAnimDelegate = new CustomTabToolbarAnimationDelegate(mSecurityButton, mTitleUrlContainer);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:CustomTabToolbar.java

示例2: 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);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:22,代码来源:AppPickerPreference.java

示例3: attachButtonListener

import android.widget.ImageButton; //导入方法依赖的package包/类
private void attachButtonListener(View v, int id, boolean longAttach) {
    ImageButton button = (ImageButton) v.findViewById(id);
    if(button == null) {
        Log.w(THIS_FILE, "Not found button " + id);
        return;
    }
    if(longAttach) {
        button.setOnLongClickListener(this);
    }else {
        button.setOnClickListener(this);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:13,代码来源:DialerFragment.java

示例4: onFinishInflate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void onFinishInflate() {

    mImageButton = (ImageButton) findViewById(R.id.abs__imageButton);
    mTextButton = (CapitalizingButton) findViewById(R.id.abs__textButton);
    mImageButton.setOnClickListener(this);
    mTextButton.setOnClickListener(this);
    mImageButton.setOnLongClickListener(this);
    setOnClickListener(this);
    setOnLongClickListener(this);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:12,代码来源:ActionMenuItemView.java

示例5: getMenuItemView

import android.widget.ImageButton; //导入方法依赖的package包/类
private View getMenuItemView(MenuItem item) {
  final ImageButton button = new ImageButton(context);
  button.setImageDrawable(item.getIcon());
  button.setBackgroundResource(R.drawable.toolbar_button);
  button.setId(item.getItemId());
  button.setLayoutParams(new LayoutParams(itemWidth,
      ViewGroup.LayoutParams.MATCH_PARENT));
  button.setOnClickListener(this);
  button.setOnLongClickListener(this);
  return button;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:12,代码来源:AyahToolBar.java

示例6: 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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:CustomButtonParams.java

示例7: DialogImageSettings

import android.widget.ImageButton; //导入方法依赖的package包/类
public DialogImageSettings(AppCompatActivity activity, ImagePropertiesChangeIf changeIf, ImageProperties parameters)
{
    super(activity, R.layout.dialog_image_settings, R.string.dialog_image_settings_title);
    this.activity = activity;
    this.parameters = parameters;

    fileName = (EditText) findViewById(R.id.dialog_file_name);
    if (parameters.fileName != null)
    {
        fileName.setText(parameters.fileName);
    }

    buttonSelectFile = (ImageButton) findViewById(R.id.dialog_button_select_file);
    buttonSelectFile.setOnClickListener(this);
    buttonSelectFile.setOnLongClickListener(this);
    ViewUtils.setImageButtonColorAttr(activity, buttonSelectFile, R.attr.colorDialogContent);

    cbEmbedded = (CheckBox) findViewById(R.id.dialog_checkbox_embedded);
    cbEmbedded.setChecked(parameters.embedded);

    pickerWidth = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_width);
    pickerWidth.setValue(parameters.width);
    pickerWidth.minValue = 0;
    pickerHeight = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_height);
    pickerHeight.setValue(parameters.height);
    pickerHeight.minValue = 0;

    rOriginalSize = (RadioButton) findViewById(R.id.dialog_button_original_size);
    rOriginalSize.setOnClickListener(this);
    rOriginalSize.setChecked(parameters.originalSize);
    rCustomSize = (RadioButton) findViewById(R.id.dialog_button_custom_size);
    rCustomSize.setOnClickListener(this);
    rCustomSize.setChecked(!parameters.originalSize);
    onClick(parameters.originalSize ? rOriginalSize : rCustomSize);

    this.changeIf = changeIf;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:38,代码来源:DialogImageSettings.java

示例8: prepare

import android.widget.ImageButton; //导入方法依赖的package包/类
private void prepare(AttributeSet attrs)
{
    setBaselineAligned(false);
    setVerticalGravity(Gravity.CENTER_VERTICAL);
    setOrientation(HORIZONTAL);
    final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.horizontal_number_picker, this);
    editText = ((EditText) findViewById(R.id.edit_text_value));
    if (attrs != null)
    {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.HorizontalNumberPicker, 0, 0);
        CharSequence label = a.getText(R.styleable.HorizontalNumberPicker_label);
        if (label != null)
        {
            ((TextView) findViewById(R.id.label_text)).setText(label);
        }
        editText.setMinimumWidth(a.getDimensionPixelSize(R.styleable.HorizontalNumberPicker_minWidth, 0));
        a.recycle();
    }

    bDecrease = (ImageButton) findViewById(R.id.button_decrease);
    bDecrease.setOnClickListener(this);
    bDecrease.setOnLongClickListener(this);
    updateViewColor(bDecrease);

    bIncrease = (ImageButton) findViewById(R.id.button_increase);
    bIncrease.setOnClickListener(this);
    bIncrease.setOnLongClickListener(this);
    updateViewColor(bIncrease);

    description = (TextView) findViewById(R.id.label_text);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:33,代码来源:HorizontalNumberPicker.java

示例9: DialogLineSettings

import android.widget.ImageButton; //导入方法依赖的package包/类
public DialogLineSettings(Activity context, LinePropertiesChangeIf changeIf, LineProperties parameters)
{
    super(context, R.layout.dialog_line_settings, R.string.dialog_line_settings_title);
    this.parameters = parameters;

    widthPicker = (HorizontalNumberPicker) findViewById(R.id.dialog_number_picker);
    widthPicker.setValue(parameters.width);
    widthPicker.minValue = 1;

    colorPicker = PrepareColorPicker(parameters.color);

    radioButtons = new RadioButton[4];
    radioButtons[0] = (RadioButton) findViewById(R.id.dialog_button_line_style_solid);
    radioButtons[1] = (RadioButton) findViewById(R.id.dialog_button_line_style_dotted);
    radioButtons[2] = (RadioButton) findViewById(R.id.dialog_button_line_style_dashed);
    radioButtons[3] = (RadioButton) findViewById(R.id.dialog_button_line_style_dash_dot);

    radioLines = new CustomTextView[radioButtons.length];
    radioLines[0] = (CustomTextView) findViewById(R.id.dialog_marker_line_style_solid);
    radioLines[1] = (CustomTextView) findViewById(R.id.dialog_marker_line_style_dotted);
    radioLines[2] = (CustomTextView) findViewById(R.id.dialog_marker_line_style_dashed);
    radioLines[3] = (CustomTextView) findViewById(R.id.dialog_marker_line_style_dash_dot);

    LineProperties l = new LineProperties();
    l.color = CompatUtils.getThemeColorAttr(getContext(), R.attr.colorDialogContent);
    l.width = ViewUtils.dpToPx(getContext().getResources().getDisplayMetrics(), 2);

    for (int i = 0; i < radioButtons.length; i++)
    {
        l.lineStyle = LineProperties.LineStyle.values()[i];
        l.preparePaint();
        radioLines[i].setExternalPaint(l.getPaint());
        radioLines[i].setOnClickListener(this);
        radioButtons[i].setChecked(l.lineStyle == parameters.lineStyle);
        radioButtons[i].setOnClickListener(this);
    }

    pointShapesBox = (CheckBox) findViewById(R.id.dialog_plot_point_shapes);
    pointShapesBox.setOnClickListener(this);
    pointShapesBox.setChecked(parameters.shapeType != LineProperties.ShapeType.NONE);

    shapeSizePicker = (HorizontalNumberPicker) findViewById(R.id.dialog_plot_point_shape_size);
    shapeSizePicker.setValue(parameters.shapeSize);
    shapeSizePicker.minValue = 100;
    shapeSizePicker.setEnabled(pointShapesBox.isChecked());

    shapeTypeButtons
            .put(LineProperties.ShapeType.SQUARE, (ImageButton) findViewById(R.id.dialog_plot_point_square));
    shapeTypeButtons
            .put(LineProperties.ShapeType.CIRCLE, (ImageButton) findViewById(R.id.dialog_plot_point_circle));
    shapeTypeButtons.put(LineProperties.ShapeType.DIAMOND,
            (ImageButton) findViewById(R.id.dialog_plot_point_diamond));
    shapeTypeButtons.put(LineProperties.ShapeType.CROSS, (ImageButton) findViewById(R.id.dialog_plot_point_cross));
    for (Map.Entry<LineProperties.ShapeType, ImageButton> e : shapeTypeButtons.entrySet())
    {
        ImageButton b = e.getValue();
        b.setOnClickListener(this);
        b.setOnLongClickListener(this);
        setButtonEnabled(b, pointShapesBox.isChecked());
        if (b.isEnabled())
        {
            setButtonSelected(b, e.getKey() == parameters.shapeType);
        }
    }

    this.changeIf = changeIf;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:68,代码来源:DialogLineSettings.java


注:本文中的android.widget.ImageButton.setOnLongClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。