當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setFocusable方法代碼示例

本文整理匯總了Java中android.widget.ImageView.setFocusable方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setFocusable方法的具體用法?Java ImageView.setFocusable怎麽用?Java ImageView.setFocusable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setFocusable方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addIconTab

import android.widget.ImageView; //導入方法依賴的package包/類
private void addIconTab(final int position, int resId) {
    ImageView tab = new ImageView(getContext()) {
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            if (pager.getAdapter() instanceof IconTabProvider) {
                ((IconTabProvider) pager.getAdapter()).customOnDraw(canvas, position);
            }
        }
    };
    tab.setFocusable(true);
    tab.setImageResource(resId);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:23,代碼來源:PagerSlidingTabStrip.java

示例2: Image

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Creates a new Image component.
 *
 * @param container  container, component will be placed in
 */
public Image(ComponentContainer container) {
  super(container);

  view = new ImageView(container.$context()) {
    @Override
    public boolean verifyDrawable(Drawable dr) {
      super.verifyDrawable(dr);
      // TODO(user): multi-image animation
      return true;
    }
  };
  view.setFocusable(true);

  // Adds the component to its designated container
  container.$add(this);
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:22,代碼來源:Image.java

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

示例4: addIconTab

import android.widget.ImageView; //導入方法依賴的package包/類
private void addIconTab(final int position, int resId) {
    ImageView tab = new ImageView(getContext());
    tab.setFocusable(true);
    tab.setImageResource(resId);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:15,代碼來源:PagerSlidingTabStrip.java

示例5: addIconTab

import android.widget.ImageView; //導入方法依賴的package包/類
public void addIconTab(int resId) {
    final int position = tabCount++;
    ImageView tab = new ImageView(getContext());
    tab.setFocusable(true);
    tab.setImageResource(resId);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            delegate.onPageSelected(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:16,代碼來源:ScrollSlidingTabStrip.java

示例6: addIcon

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * 添加圖標
 */
private void addIcon(){
    iconImageView = new ImageView(getContext());
    iconImageView.setFocusable(false);
    iconImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    iconImageView.setImageResource(iconResId);

    int size = DimensUtils.dpToPx(getContext(),20);
    LinearLayout.LayoutParams llp = new LayoutParams(size,size);
    addView(iconImageView,llp);

}
 
開發者ID:VK2012,項目名稱:AppCommonFrame,代碼行數:15,代碼來源:BottomNavButton.java

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

示例8: getItemImageButton

import android.widget.ImageView; //導入方法依賴的package包/類
public static ImageView getItemImageButton(Context context, MenuObject item) {
    ImageView imageView = new ImageButton(context);
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    imageView.setLayoutParams(lp);
    imageView.setPadding((int) context.getResources().getDimension(R.dimen.menu_item_padding),
            (int) context.getResources().getDimension(R.dimen.menu_item_padding),
            (int) context.getResources().getDimension(R.dimen.menu_item_padding),
            (int) context.getResources().getDimension(R.dimen.menu_item_padding));
    imageView.setClickable(false);
    imageView.setFocusable(false);
    imageView.setBackgroundColor(Color.TRANSPARENT);

    if (item.getColor() != 0) {
        Drawable color = new ColorDrawable(item.getColor());
        imageView.setImageDrawable(color);
    } else if (item.getResource() != 0) {
        imageView.setImageResource(item.getResource());
    } else if (item.getBitmap() != null) {
        imageView.setImageBitmap(item.getBitmap());
    } else if (item.getDrawable() != null) {
        imageView.setImageDrawable(item.getDrawable());
    }
    imageView.setScaleType(item.getScaleType());

    return imageView;
}
 
開發者ID:zongkaili,項目名稱:MenuSet,代碼行數:28,代碼來源:Utils.java

示例9: InfoBarLayout

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Constructs a layout for the specified infobar. After calling this, be sure to set the
 * message, the buttons, and/or the custom content using setMessage(), setButtons(), and
 * setCustomContent().
 *
 * @param context The context used to render.
 * @param infoBarView InfoBarView that listens to events.
 * @param iconResourceId ID of the icon to use for the infobar.
 * @param iconBitmap Bitmap for the icon to use, if the resource ID wasn't passed through.
 * @param message The message to show in the infobar.
 */
public InfoBarLayout(Context context, InfoBarView infoBarView, int iconResourceId,
        Bitmap iconBitmap, CharSequence message) {
    super(context);
    mControlLayouts = new ArrayList<InfoBarControlLayout>();

    mInfoBarView = infoBarView;

    // Cache resource values.
    Resources res = getResources();
    mSmallIconSize = res.getDimensionPixelSize(R.dimen.infobar_small_icon_size);
    mSmallIconMargin = res.getDimensionPixelSize(R.dimen.infobar_small_icon_margin);
    mBigIconSize = res.getDimensionPixelSize(R.dimen.infobar_big_icon_size);
    mBigIconMargin = res.getDimensionPixelSize(R.dimen.infobar_big_icon_margin);
    mMarginAboveButtonGroup =
            res.getDimensionPixelSize(R.dimen.infobar_margin_above_button_row);
    mMarginAboveControlGroups =
            res.getDimensionPixelSize(R.dimen.infobar_margin_above_control_groups);
    mPadding = res.getDimensionPixelOffset(R.dimen.infobar_padding);
    mMinWidth = res.getDimensionPixelSize(R.dimen.infobar_min_width);
    mAccentColor = ApiCompatibilityUtils.getColor(res, R.color.infobar_accent_blue);

    // Set up the close button. Apply padding so it has a big touch target.
    mCloseButton = new ImageButton(context);
    mCloseButton.setId(R.id.infobar_close_button);
    mCloseButton.setImageResource(R.drawable.btn_close);
    TypedArray a = getContext().obtainStyledAttributes(
            new int [] {R.attr.selectableItemBackground});
    Drawable closeButtonBackground = a.getDrawable(0);
    a.recycle();
    mCloseButton.setBackground(closeButtonBackground);
    mCloseButton.setPadding(mPadding, mPadding, mPadding, mPadding);
    mCloseButton.setOnClickListener(this);
    mCloseButton.setContentDescription(res.getString(R.string.infobar_close));
    mCloseButton.setLayoutParams(new LayoutParams(0, -mPadding, -mPadding, -mPadding));

    // Set up the icon.
    if (iconResourceId != 0 || iconBitmap != null) {
        mIconView = new ImageView(context);
        if (iconResourceId != 0) {
            mIconView.setImageResource(iconResourceId);
        } else if (iconBitmap != null) {
            mIconView.setImageBitmap(iconBitmap);
        }
        mIconView.setLayoutParams(new LayoutParams(0, 0, mSmallIconMargin, 0));
        mIconView.getLayoutParams().width = mSmallIconSize;
        mIconView.getLayoutParams().height = mSmallIconSize;
        mIconView.setFocusable(false);
    }

    // Set up the message view.
    mMessageMainText = message;
    mMessageLayout = new InfoBarControlLayout(context);
    mMessageTextView = mMessageLayout.addMainMessage(prepareMainMessageString());
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:66,代碼來源:InfoBarLayout.java


注:本文中的android.widget.ImageView.setFocusable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。