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


Java ImageView.setClickable方法代码示例

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


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

示例1: initIconView

import android.widget.ImageView; //导入方法依赖的package包/类
private View initIconView() {
    FrameLayout contentView = new FrameLayout(LiteIconActivity.this);
    int gridW = (int) (displayMetrics.density * GRID_W_IN_DP);
    int gridH = (int) (displayMetrics.density * GRID_H_IN_DP);
    ViewGroup.LayoutParams lpCv = new ViewGroup.LayoutParams(gridW, gridH);
    contentView.setLayoutParams(lpCv);

    ImageView ivIcon = new ImageView(LiteIconActivity.this);
    ivIcon.setTag("iv");
    ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ivIcon.setClickable(true);
    ivIcon.setBackgroundResource(getClickBg());
    int iconSize = (int) (displayMetrics.density * ICON_SIZE_IN_DP);
    FrameLayout.LayoutParams lpIv = new FrameLayout.LayoutParams(iconSize, iconSize);
    lpIv.gravity = Gravity.CENTER;
    ivIcon.setLayoutParams(lpIv);
    contentView.addView(ivIcon);

    return contentView;
}
 
开发者ID:by-syk,项目名称:NanoIconPackLite,代码行数:21,代码来源:LiteIconActivity.java

示例2: draw

import android.widget.ImageView; //导入方法依赖的package包/类
public void draw() {

        windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
        Display deviceDisplay = windowManager.getDefaultDisplay();
        Point point = new Point();
        deviceDisplay.getSize(point);
        deviceWidth = point.x;
        deviceHeight = point.y;

        imageView = new ImageView(this);
        imageView.setClickable(false);
        imageView.setFocusable(false);
        imageView.setMinimumHeight(deviceHeight);
        imageView.setMinimumWidth(deviceWidth);

        drawKeylines();

    }
 
开发者ID:balsikandar,项目名称:KeylineMaterialDesign,代码行数:19,代码来源:KeylineDrawService.java

示例3: getItemImageView

import android.widget.ImageView; //导入方法依赖的package包/类
public static ImageView getItemImageView(Context context, @DrawableRes int placeholderResId, ImageView.ScaleType scaleType) {
    ImageView imageView = new ImageView(context);
    imageView.setImageResource(placeholderResId);
    imageView.setClickable(true);
    imageView.setScaleType(scaleType);
    return imageView;
}
 
开发者ID:weileng11,项目名称:KUtils-master,代码行数:8,代码来源:BGABannerUtil.java

示例4: setColorPreview

import android.widget.ImageView; //导入方法依赖的package包/类
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:35,代码来源:ColorPickerView.java

示例5: onCreateViewHolder

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    FrameLayout contentView = new FrameLayout(LiteIconActivityV1.this);
    int gridW = (int) (displayMetrics.density * GRID_W_IN_DP);
    int gridH = (int) (displayMetrics.density * GRID_H_IN_DP);
    ViewGroup.LayoutParams lpCv = new ViewGroup.LayoutParams(gridW, gridH);
    contentView.setLayoutParams(lpCv);

    ImageView ivIcon = new ImageView(LiteIconActivityV1.this);
    ivIcon.setTag("iv");
    ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ivIcon.setClickable(true);
    ivIcon.setBackgroundResource(getClickBg());
    int iconSize = (int) (displayMetrics.density * ICON_SIZE_IN_DP);
    FrameLayout.LayoutParams lpIv = new FrameLayout.LayoutParams(iconSize, iconSize);
    lpIv.gravity = Gravity.CENTER;
    ivIcon.setLayoutParams(lpIv);
    contentView.addView(ivIcon);

    return new IconHolder(contentView);
}
 
开发者ID:by-syk,项目名称:NanoIconPackLite,代码行数:22,代码来源:LiteIconActivityV1.java

示例6: initIconView

import android.widget.ImageView; //导入方法依赖的package包/类
private View initIconView() {
    FrameLayout contentView = new FrameLayout(LiteIconActivityV2.this);
    int gridW = (int) (displayMetrics.density * GRID_W_IN_DP);
    int gridH = (int) (displayMetrics.density * GRID_H_IN_DP);
    ViewGroup.LayoutParams lpCv = new ViewGroup.LayoutParams(gridW, gridH);
    contentView.setLayoutParams(lpCv);

    ImageView ivIcon = new ImageView(LiteIconActivityV2.this);
    ivIcon.setTag("iv");
    ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ivIcon.setClickable(true);
    ivIcon.setBackgroundResource(getClickBg());
    int iconSize = (int) (displayMetrics.density * ICON_SIZE_IN_DP);
    FrameLayout.LayoutParams lpIv = new FrameLayout.LayoutParams(iconSize, iconSize);
    lpIv.gravity = Gravity.CENTER;
    ivIcon.setLayoutParams(lpIv);
    contentView.addView(ivIcon);

    return contentView;
}
 
开发者ID:by-syk,项目名称:NanoIconPackLite,代码行数:21,代码来源:LiteIconActivityV2.java

示例7: setInvisible

import android.widget.ImageView; //导入方法依赖的package包/类
private void setInvisible() {
    // Log.d("COLLAGE", "Setting something invisible...");
    if (imageViewReference != null) {
        final ImageView imageView = imageViewReference.get();
        BitmapFetcherTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
        if (this == bitmapDownloaderTask) {
            imageView.setVisibility(View.GONE);
            imageView.setClickable(false);
            imageView.setEnabled(false);
        }
    }
}
 
开发者ID:abelabbesnabi,项目名称:cordova-plugin-image-picker,代码行数:13,代码来源:ImageFetcher.java

示例8: onCreateOptionsMenu

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_user_profile, menu);
    notification_item = (ImageView) menu.findItem(R.id.action_notification).getActionView();
    messages_item = (ImageView) menu.findItem(R.id.action_message).getActionView();
    activity_post = (ImageView) menu.findItem(R.id.action_status_post).getActionView();

    if(mCurrentUser != null) {
        menu.findItem(R.id.action_notification).setVisible(true);
        menu.findItem(R.id.action_message).setVisible(true);
        menu.findItem(R.id.action_status_post).setVisible(true);


        notification_item.setImageDrawable(mCurrentUser.getNotifications() > 0?
                             ContextCompat.getDrawable(this, R.drawable.ic_notifications_active_white_24dp):
                             ContextCompat.getDrawable(this, R.drawable.ic_notifications_none_white_24dp)
                    );
        notification_item.setPadding(0,0,20,0);

        messages_item.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_mail_outline_white_24dp));
        messages_item.setPadding(25,0,30,0);

        activity_post.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_chat_bubble_outline_white_24dp));
        activity_post.setPadding(25,0,15,0);

        notification_item.setClickable(true);
        activity_post.setClickable(true);
        messages_item.setClickable(true);

        notification_item.setOnClickListener(this);
        messages_item.setOnClickListener(this);
        activity_post.setOnClickListener(this);

        showTutorial();
    }
    return true;
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:39,代码来源:ProfileActivity.java

示例9: onProgressUpdate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onProgressUpdate(DonateActivity.DonateItem... values) {
    if (mReference.get() != null) {
        DonateActivity.DonateItem item = values[0];
        ImageView donate = item.imageView;
        donate.setContentDescription(item.label);
        donate.setImageDrawable(item.icon);
        donate.setClickable(true);
        donate.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:12,代码来源:DonateTask.java

示例10: onCreateView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    mImageView = (ImageView) rootView.findViewById(R.id.image_content);
    mImageView.setClickable(true);
    mImageView.setFocusable(true);
    mImageView.setImageResource(res);
    return rootView;
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:11,代码来源:MainContentFragment.java

示例11: onBindViewHolder

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(TranslationViewHolder holder, int position) {
  TranslationRowData rowItem = translations.get(position);
  switch (holder.getItemViewType()) {
    case R.layout.translation_row:
      TranslationItem item = (TranslationItem) rowItem;
      holder.getTranslationTitle().setText(item.name());
      if (TextUtils.isEmpty(item.translation.translatorNameLocalized)) {
        holder.getTranslationInfo().setText(item.translation.translator);
      } else {
        holder.getTranslationInfo().setText(item.translation.translatorNameLocalized);
      }

      ImageView leftImage = holder.getLeftImage();
      ImageView rightImage = holder.getRightImage();

      if (item.exists()) {
        if (item.needsUpgrade()) {
          leftImage.setImageResource(R.drawable.ic_download);
          leftImage.setVisibility(View.VISIBLE);
          holder.getTranslationInfo().setText(R.string.update_available);
        } else {
          leftImage.setVisibility(View.GONE);
        }
        rightImage.setImageResource(R.drawable.ic_cancel);
        rightImage.setVisibility(View.VISIBLE);
        rightImage.setContentDescription(context.getString(R.string.remove_button));
      } else {
        leftImage.setVisibility(View.GONE);
        rightImage.setImageResource(R.drawable.ic_download);
        rightImage.setVisibility(View.VISIBLE);
        rightImage.setOnClickListener(null);
        rightImage.setClickable(false);
        rightImage.setContentDescription(null);
      }
      break;
    case R.layout.translation_sep:
      holder.getSeparatorText().setText(rowItem.name());
      break;
  }
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:42,代码来源:TranslationsAdapter.java

示例12: ViewHold

import android.widget.ImageView; //导入方法依赖的package包/类
public ViewHold(View itemView) {
    super(itemView);
    image = (ImageView) itemView.findViewById(R.id.home_item_image);
    image.setClickable(false);
    title = (TextView) itemView.findViewById(R.id.collection_item_title);
    info = (TextView) itemView.findViewById(R.id.collection_item_info);
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:8,代码来源:HomeCollectionItemBinder.java

示例13: inflateTabSwitchingResources

import android.widget.ImageView; //导入方法依赖的package包/类
private void inflateTabSwitchingResources() {
    mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_button);
    mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button);

    mToggleTabStackButton.setClickable(false);
    Resources resources = getResources();
    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(resources, false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(resources, true);
    mToggleTabStackButton.setImageDrawable(mTabSwitcherButtonDrawable);
    mTabSwitcherModeViews.add(mNewTabButton);

    // Ensure that the new tab button will not draw over the toolbar buttons if the
    // translated string is long.  Set a margin to the size of the toolbar button container
    // for the new tab button.
    WindowManager wm = (WindowManager) getContext().getSystemService(
            Context.WINDOW_SERVICE);
    Point screenSize = new Point();
    wm.getDefaultDisplay().getSize(screenSize);

    mToolbarButtonsContainer.measure(
            MeasureSpec.makeMeasureSpec(screenSize.x, MeasureSpec.AT_MOST),
            MeasureSpec.makeMeasureSpec(screenSize.y, MeasureSpec.AT_MOST));

    ApiCompatibilityUtils.setMarginEnd(getFrameLayoutParams(mNewTabButton),
            mToolbarButtonsContainer.getMeasuredWidth());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:29,代码来源:ToolbarPhone.java

示例14: gameEnd

import android.widget.ImageView; //导入方法依赖的package包/类
private void gameEnd() {
    //disable submit button
    ImageView image = findViewById(R.id.submit);
    image.setClickable(false);

    //disable pin +/- buttons
    ImageView image2 = findViewById(R.id.minus);
    image2.setClickable(false);
    ImageView image3 = findViewById(R.id.plus);
    image3.setClickable(false);

    //hide active player icon
    activePlayer1.setVisibility(activePlayer1.INVISIBLE);
    activePlayer2.setVisibility(activePlayer2.INVISIBLE);

    // use pin selection ImageView to display winner
    if (tScorePlayer1 > tScorePlayer2) {
        Drawable player1Win = getResources().getDrawable(R.drawable.playeronewin);
        imageViewDownedPins.setImageDrawable(player1Win);
    } else if (tScorePlayer2 > tScorePlayer1) {
        Drawable player2Win = getResources().getDrawable(R.drawable.playertwowin);
        imageViewDownedPins.setImageDrawable(player2Win);
    } else {
        Drawable draw = getResources().getDrawable(R.drawable.draw);
        imageViewDownedPins.setImageDrawable(draw);
    }
}
 
开发者ID:adriantache,项目名称:Bowling-Scoring,代码行数:28,代码来源:MainActivity.java

示例15: resetGame

import android.widget.ImageView; //导入方法依赖的package包/类
public void resetGame(View v) {

        // reset all scores and active player icon
        frameScoresPlayer1 = new int[22];
        frameScoresPlayer2 = new int[22];
        frameTotalScoresPlayer1 = new int[11];
        frameTotalScoresPlayer2 = new int[11];
        tScorePlayer1 = 0;
        tScorePlayer2 = 0;
        activePlayer = 2;
        updateScores();
        activePlayer();
        updateScores();

        // reset relevant variables
        downedPinsPointer = -1;
        frameNumber = 1;
        frameEnd = false;
        extraScore = false;
        maxPins = 10;

        // set number of pins ImageView to the instructions
        Drawable instructions = getResources().getDrawable(R.drawable.instructions);
        imageViewDownedPins.setImageDrawable(instructions);

        //reset submit button
        ImageView image = findViewById(R.id.submit);
        image.setClickable(true);

        //reset pin +/- buttons
        ImageView image2 = findViewById(R.id.minus);
        image2.setClickable(true);
        ImageView image3 = findViewById(R.id.plus);
        image3.setClickable(true);
    }
 
开发者ID:adriantache,项目名称:Bowling-Scoring,代码行数:36,代码来源:MainActivity.java


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