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


Java ImageButton.setOnClickListener方法代码示例

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


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

示例1: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frm_clientes);

    RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.rvClientes);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(frmClientes.this));
    mRecyclerView.addItemDecoration(new SpacesItemDecoration(Funcoes.SPACE_BETWEEN_ITEMS));

    mAdapter = new adpClientes(frmClientes.this, mRecyclerView);
    mRecyclerView.setAdapter(mAdapter);

    ImageButton btnAdd = (ImageButton) findViewById(R.id.btnAdd);
    btnAdd.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent intent = new Intent(frmClientes.this, frmManutencaoClientes.class);
            intent.putExtra("Operacao", "I");
            startActivity(intent);
        }
    });
}
 
开发者ID:marcelohanel,项目名称:Cash,代码行数:24,代码来源:frmClientes.java

示例2: initUI

import android.widget.ImageButton; //导入方法依赖的package包/类
private void initUI(){		
	previewOperationBar = (LinearLayout) findViewById(R.id.picker_image_preview_operator_bar);
	originalImage = (ImageButton) findViewById(R.id.picker_image_preview_orignal_image);
	originalImage.setOnClickListener(this);
	originalImageSizeTip = (TextView) findViewById(R.id.picker_image_preview_orignal_image_tip);
	if(!isSupportOriginal){
		originalImage.setVisibility(View.INVISIBLE);
		originalImageSizeTip.setVisibility(View.INVISIBLE);
	}
	previewSendBtn = (TextView) findViewById(R.id.picker_image_preview_send);
	previewSendBtn.setOnClickListener(this);
	updateSelectBtnStatus();
	updateOriImageSizeTip(isSendOriginalImage);
			
	imageViewPager = (ViewPager) findViewById(R.id.picker_image_preview_viewpager);
	imageViewPager.setOnPageChangeListener(this);
	imageViewPager.setOffscreenPageLimit(2);
	imageViewPagerAdapter = new PickerPreviewPagerAdapter(this, photoLists, getLayoutInflater(),
			imageViewPager.getLayoutParams().width, imageViewPager.getLayoutParams().height, this);
	imageViewPager.setAdapter(imageViewPagerAdapter);
	
	setTitleIndex(firstDisplayImageIndex);
	updateTitleSelect(firstDisplayImageIndex);
	imageViewPager.setCurrentItem(firstDisplayImageIndex);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:26,代码来源:PickerAlbumPreviewActivity.java

示例3: initialize

import android.widget.ImageButton; //导入方法依赖的package包/类
private void initialize() {
    LayoutInflater.from(getContext()).inflate(R.layout.match_card_view, this);

    /*
     * Get view references
     */
    profileImageView = (ImageView) findViewById(R.id.match_card_view_profile_image);
    nameTextView = (TextView) findViewById(R.id.match_card_view_name_text);
    ageTextView = (TextView) findViewById(R.id.match_card_view_age_text);
    filterImageView = (ImageView) findViewById(R.id.match_card_view_filter_image);
    bioTextView = (TextView) findViewById(R.id.match_card_view_bio_text);
    scoreTextView = (TextView) findViewById(R.id.match_card_view_score_text);

    rejectButton = (Button) findViewById(R.id.match_card_view_reject_button);
    acceptButton = (Button) findViewById(R.id.match_card_view_accept_button);
    chatButton = (ImageButton) findViewById(R.id.match_card_view_chat_button);

    rejectButton.setOnClickListener(rejectClickListener);
    acceptButton.setOnClickListener(acceptClickListener);
    chatButton.setOnClickListener(chatClickListener);
}
 
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:22,代码来源:MatchCardView.java

示例4: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    FrameLayout view = (FrameLayout) LayoutInflater.from(getContext()).inflate(
            R.layout.dialog_with_titlebar, null);
    view.addView(mPage.getView(), 0);
    setContentView(view);

    getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    TextView title = (TextView) view.findViewById(R.id.title);
    title.setText(mPage.getTitle());

    ImageButton closeButton = (ImageButton) view.findViewById(R.id.close_button);
    closeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:NativePageDialog.java

示例5: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);


    go = (Button) findViewById(R.id.button2);
    go.setOnClickListener(btGo);
    location = (EditText) findViewById(R.id.editLocation);
    progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);
    SubjectListView = (ListView) findViewById(R.id.listview1);
    trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
    userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
    locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
    settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
    addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
    trendingBtm.setOnClickListener(btTrending);
    userBtm.setOnClickListener(btUser);
    locationBtm.setOnClickListener(btlocation);
    settingsBtm.setOnClickListener(btSettings);
    addReviewBtm.setOnClickListener(btAdd);


}
 
开发者ID:cdc03819,项目名称:BrewBook,代码行数:25,代码来源:MapsActivity.java

示例6: onCreateView

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    controlView = inflater.inflate(R.layout.fragment_hud, container, false);

    // Create UI controls.
    encoderStatView = (TextView) controlView.findViewById(R.id.encoder_stat_call);
    hudViewBwe = (TextView) controlView.findViewById(R.id.hud_stat_bwe);
    hudViewConnection = (TextView) controlView.findViewById(R.id.hud_stat_connection);
    hudViewVideoSend = (TextView) controlView.findViewById(R.id.hud_stat_video_send);
    hudViewVideoRecv = (TextView) controlView.findViewById(R.id.hud_stat_video_recv);
    toggleDebugButton = (ImageButton) controlView.findViewById(R.id.button_toggle_debug);

    toggleDebugButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (displayHud) {
                int visibility =
                        (hudViewBwe.getVisibility() == View.VISIBLE) ? View.INVISIBLE : View.VISIBLE;
                hudViewsSetProperties(visibility);
            }
        }
    });

    return controlView;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:27,代码来源:HudFragment.java

示例7: createCloseButtonClickListener

import android.widget.ImageButton; //导入方法依赖的package包/类
/**
 * Creates and returns a listener, which allows to close a specific tab, when its close button
 * is clicked.
 *
 * @param closeButton
 *         The tab's close button as an instance of the class {@link ImageButton}. The button
 *         may not be null
 * @param tab
 *         The tab, which should be closed, as an instance of the class {@link Tab}. The tab may
 *         not be null
 * @return The listener, which has been created, as an instance of the class {@link
 * OnClickListener}. The listener may not be null
 */
@NonNull
private OnClickListener createCloseButtonClickListener(@NonNull final ImageButton closeButton,
                                                       @NonNull final Tab tab) {
    return new OnClickListener() {

        @Override
        public void onClick(final View v) {
            if (notifyOnCloseTab(tab)) {
                closeButton.setOnClickListener(null);
                tabSwitcher.removeTab(tab);
            }
        }

    };
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:29,代码来源:PhoneRecyclerAdapter.java

示例8: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    errorContainer = (LinearLayout) findViewById(R.id.error_container);
    ImageButton errorIcon = (ImageButton) findViewById(R.id.error_icon);
    errorIcon.setOnClickListener(this);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    applyFontsToTitle(toolbar);

    list = (RecyclerView) findViewById(R.id.list);
    refresh = (SwipeRefreshLayout) findViewById(R.id.refreshLayout);

    toolbar.setOnClickListener(v -> list.scrollToPosition(0));

    url = getString(R.string.pic_category_url, 21, page);
    setupRecyclerView();

    toolbar.setOnClickListener(v -> list.scrollToPosition(0));

    loadData(true);
}
 
开发者ID:Assassinss,项目名称:Moment,代码行数:26,代码来源:MainActivity.java

示例9: initUi

import android.widget.ImageButton; //导入方法依赖的package包/类
private void initUi() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.hide();

    printerlist_list = (ListView) findViewById(R.id.printerlist_list);
    toolbar_refresh = (Button) findViewById(R.id.toolbar_refresh);
    toolbar_left_button = (ImageButton) findViewById(R.id.toolbar_left_button);

    printerlist_active = (TextView) findViewById(R.id.printerlist_active);
    printerlist_progress = (ProgressBar) findViewById(R.id.printerlist_progress);
    printerlist_content = (LinearLayout) findViewById(R.id.printerlist_content);

    printerlist_progress.setVisibility(View.GONE);

    toolbar_left_button.setOnClickListener(this);
    toolbar_refresh.setOnClickListener(this);
    printerlist_list.setOnItemClickListener(this);
}
 
开发者ID:barisatalay,项目名称:thermalprinterhelper,代码行数:19,代码来源:PrinterListActivity.java

示例10: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_formulario);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    helper = new Helper(FormularioActivity.this);

    if(Singleton.getInstance().currentUser != null){
        helper.preencherFormulario(Singleton.getInstance().currentUser);
    } else{
        Toast.makeText(FormularioActivity.this, "Campos com * são obrigatórios!", Toast.LENGTH_SHORT).show();
    }

    final ImageButton imageButton = (ImageButton) findViewById(R.id.escolher_foto);


    imageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent selecionarFoto = new Intent();
            selecionarFoto.setType("image/*");
            selecionarFoto.setAction(Intent.ACTION_GET_CONTENT);

            caminhoFoto = getExternalFilesDir(null) + "/" + System.currentTimeMillis() + ".png";
            File arquivo = new File(caminhoFoto);

            Uri localFoto = Uri.fromFile(arquivo);

            selecionarFoto.putExtra(MediaStore.EXTRA_OUTPUT, localFoto);

            //startActivityForResult(Intent.createChooser(selecionarFoto, "selecionarFoto"), GALLERY_IMAGE_REQUEST);
            startActivityForResult(selecionarFoto, GALLERY_IMAGE_REQUEST);
        }
    });

}
 
开发者ID:robsonribeiroft,项目名称:nucleus-test,代码行数:38,代码来源:FormularioActivity.java

示例11: createListenerCancelButton

import android.widget.ImageButton; //导入方法依赖的package包/类
/**
 * This methode have to be called inside the on Create view of the child
 * @param cancel : the cancel Image button, present in the layout
 */
protected void createListenerCancelButton(ImageButton cancel)
{
    cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dismiss();
        }
    });
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:14,代码来源:DialogFragmentSetValue.java

示例12: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_layout);

  seekBar = (SeekBar) findViewById(R.id.seek_bar);
  seekBar.setOnSeekBarChangeListener(new SeekBarListener());
  statusText = (TextView) findViewById(R.id.status_text);

  // Make the source link clickable.
  TextView sourceText = (TextView) findViewById(R.id.source);
  sourceText.setText(Html.fromHtml(getString(R.string.source)));
  sourceText.setMovementMethod(LinkMovementMethod.getInstance());

  // Bind input and output objects for the view.
  videoWidgetView = (VrVideoView) findViewById(R.id.video_view);
  videoWidgetView.setEventListener(new ActivityEventListener());

  volumeToggle = (ImageButton) findViewById(R.id.volume_toggle);
  volumeToggle.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      setIsMuted(!isMuted);
    }
  });

  loadVideoStatus = LOAD_VIDEO_STATUS_UNKNOWN;

  // Initial launch of the app or an Activity recreation due to rotation.
  handleIntent(getIntent());
}
 
开发者ID:HackingForGood,项目名称:RealityCheck,代码行数:32,代码来源:SimpleVrVideoActivity.java

示例13: initToolbar

import android.widget.ImageButton; //导入方法依赖的package包/类
private void initToolbar(int flag) {
    Button mToolbarButton = (Button) findViewById(R.id.tool_bar_button);
    mToolbarButton.setVisibility(View.GONE);
    ImageButton mSearchButton = (ImageButton) findViewById(R.id.search_button);
    mSearchButton.setVisibility(View.GONE);

    mTitleText = (TextView) findViewById(R.id.title_text);
    if (flag == FLAG_ALL_CATEGORY) {
        mTitleText.setText(TITLE_CATEGORY);
    } else if (flag == FLAG_HOT_SUBJECT) {
        mTitleText.setText(TITLE_SUBJECT);
    } else if (flag == FLAG_ALL_AUTHOR) {
        mTitleText.setText(TITLE_AUTHOR);
    }
    mTitleText.setTextSize(16);
    mTitleText.setTypeface(Typeface.createFromAsset(getAssets(), getString(R.string.DB1FontPath)));

    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    ImageButton mExitButton = new ImageButton(this);
    mExitButton.setBackgroundResource(R.drawable.ic_action_back_black);
    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.tool_bar_layout);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(100, 120);
    params.gravity = Gravity.CENTER_VERTICAL;
    params.leftMargin = 10;
    frameLayout.addView(mExitButton, params);

    setSupportActionBar(mToolbar);
    mExitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:35,代码来源:RecyclerViewActivity.java

示例14: onCreate

import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
protected void onCreate( Bundle savedInstanceState ) {
    super.onCreate( savedInstanceState );

    setContentView( R.layout.activity_main );
    txtHablado = (TextView) findViewById( R.id.txtHablado );
    txtServer = (EditText) findViewById( R.id.txtServer );
    txtTopico = (EditText) findViewById( R.id.txtTopico );
    btnSpeak = (ImageButton) findViewById( R.id.btnSpeak );

    SharedPreferences sharedPref = getPreferences( Context.MODE_PRIVATE );
    String savedServer = sharedPref.getString( getString( R.string.SavedServerKey ), getString( R.string.DefaultServer ) );
    String savedTopic = sharedPref.getString( getString( R.string.SavedTopicKey ), getString( R.string.DefaultTopic ) );
    txtServer.setText( savedServer );
    txtTopico.setText( savedTopic );

    btnSpeak.setOnClickListener( new View.OnClickListener() {
        @Override
        public void onClick( View v ) {
            btnSpeak.setEnabled( false );
            txtHablado.setText( null );
            CheckBox modoOffline = (CheckBox) findViewById( R.id.modoOffline );

            Intent intent = new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH );
            intent.putExtra( RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM );
            if( modoOffline.isChecked())
                intent.putExtra( RecognizerIntent.EXTRA_PREFER_OFFLINE, true );
            try {
                startActivityForResult( intent, REQUEST_CODE );
            } catch ( ActivityNotFoundException a ) {
                Toast.makeText(getApplicationContext(), "Speech Recognizer no soportado", Toast.LENGTH_SHORT).show();
                btnSpeak.setEnabled( true );
            }
        }
    });
}
 
开发者ID:titos-carrasco,项目名称:VoiceAndMQTT,代码行数:37,代码来源:MainActivity.java

示例15: 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


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