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


Java ImageView.setOnClickListener方法代碼示例

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


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

示例1: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ImageView mBtnDel = (ImageView) findViewById(R.id.btn_del);
    mBtnDel.setOnClickListener(this);
    mBtnDel.setVisibility(View.VISIBLE);
    topBar.findViewById(R.id.btn_back).setOnClickListener(this);

    mTitleCount.setText(getString(R.string.preview_image_count, mCurrentPosition + 1, mImageItems.size()));
    //滑動ViewPager的時候,根據外界的數據改變當前的選中狀態和當前的圖片的位置描述文本
    mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            mCurrentPosition = position;
            mTitleCount.setText(getString(R.string.preview_image_count, mCurrentPosition + 1, mImageItems.size()));
        }
    });
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:20,代碼來源:ImagePreviewDelActivity.java

示例2: initViews

import android.widget.ImageView; //導入方法依賴的package包/類
private void initViews() {
    setClickable(true);
    setBackgroundColor(getResources().getColor(R.color.rc_normal));
    RelativeLayout recognizerContainer = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.rc_view_recognizer, null);
    imgMic = (ImageView) recognizerContainer.findViewById(R.id.img_mic);
    imgMic.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            startRecognize();
        }
    });
    TextView tvClear = (TextView) recognizerContainer.findViewById(R.id.btn_clear);
    tvClear.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != resultCallBack) {
                resultCallBack.onClearClick();
            }
        }
    });
    rlBottom = (RelativeLayout) recognizerContainer.findViewById(R.id.rl_bottom);
    addView(recognizerContainer);
    random = new Random();
}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:25,代碼來源:RecognizerView.java

示例3: getItemView

import android.widget.ImageView; //導入方法依賴的package包/類
public View getItemView(int position, View convertView, ViewHolder holder) {
    CustomFood food = (CustomFood) getItem(position);
    if (food != null) {
        ImageView civ_title = (ImageView) holder.getView(R.id.civ_icon);
        TextView tv_calory = (TextView) holder.getView(R.id.tv_calory);
        TextView tv_unit = (TextView) holder.getView(R.id.tv_unit);
        ImageView iv_health_light = (ImageView) holder.getView(R.id.iv_light);
        ((TextView) holder.getView(R.id.tv_name)).setText(food.food_name);
        ImageLoader.getInstance().displayImage(food.image_url, civ_title, ImageLoaderOptions
                .global((int) R.drawable.aa2));
        if (TextUtils.isEmpty(food.calory) || TextUtils.isEmpty(food.calory)) {
            tv_calory.setText("0");
        } else {
            tv_calory.setText(Math.round(Float.parseFloat(food.calory)) + "");
        }
        tv_unit.setText(String.format(" 千卡/%1$s%2$s", new Object[]{food.amount, food
                .unit_name}));
        iv_health_light.setBackgroundResource(R.drawable.a9a);
        iv_health_light.setOnClickListener(new DelListener(position));
    }
    return convertView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:23,代碼來源:CustomFoodListAdapter.java

示例4: initView

import android.widget.ImageView; //導入方法依賴的package包/類
private void initView() {
    lightOff = (ImageView) findViewById(R.id.light_off);
    lightOn = (ImageView) findViewById(R.id.light_on);
    ImageView setImg = (ImageView) findViewById(R.id.main_setting);
    ImageView backWifiList = (ImageView) findViewById(R.id.back_wifi_list);
    ImageView setTimeImg = (ImageView) findViewById(R.id.main_set_time);

    if (lightOff != null && lightOn != null && setImg != null && setTimeImg != null && backWifiList != null) {
        lightOff.setOnClickListener(this);
        lightOn.setOnClickListener(this);
        setImg.setOnClickListener(this);
        backWifiList.setOnClickListener(this);
        setTimeImg.setOnClickListener(this);
    }

}
 
開發者ID:stewForAni,項目名稱:Lamp,代碼行數:17,代碼來源:MainActivity.java

示例5: init

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void init(Context context) {
    super.init(context);
    bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
    titleTextView = (TextView) findViewById(R.id.title);
    backButton = (ImageView) findViewById(R.id.back);
    thumbImageView = (ImageView) findViewById(R.id.thumb);
    coverImageView = (ImageView) findViewById(R.id.cover);
    loadingProgressBar = (ProgressBar) findViewById(R.id.loading);
    tinyBackImageView = (ImageView) findViewById(R.id.back_tiny);

    thumbImageView.setOnClickListener(this);
    backButton.setOnClickListener(this);
    tinyBackImageView.setOnClickListener(this);

}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:17,代碼來源:JCVideoPlayerStandard.java

示例6: createImageView

import android.widget.ImageView; //導入方法依賴的package包/類
private ImageView createImageView(int position, final boolean isMultiImage) {
	String url = imagesList.get(position);
	ImageView imageView = new ColorFilterImageView(getContext());
	if(isMultiImage){
		imageView.setScaleType(ScaleType.CENTER_CROP);
		imageView.setLayoutParams(position % MAX_PER_ROW_COUNT == 0 ?moreParaColumnFirst : morePara);
	}else {
		imageView.setAdjustViewBounds(true);
		imageView.setScaleType(ScaleType.CENTER_CROP);
		imageView.setMaxHeight(pxOneMaxWandH);
		imageView.setLayoutParams(onePicPara);
	}

	imageView.setTag(R.string.zone_img_position,position);
	imageView.setId(url.hashCode());
	imageView.setOnClickListener(mImageViewOnClickListener);
	ImageLoaderUtils.display(getContext(), imageView, ImageUtil.getImageUrl(url));
	return imageView;
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:20,代碼來源:MultiImageView.java

示例7: AlbumViewHolder

import android.widget.ImageView; //導入方法依賴的package包/類
@SuppressLint("CutPasteId")
public AlbumViewHolder(View itemView) {
    super(itemView);

    if (layoutID == R.layout.item_grid_view || layoutID == R.layout.recent_list) {
        AlbumArtwork = (ImageView) itemView.findViewById(R.id.album_artwork);
        AlbumName = (TextView) itemView.findViewById(R.id.album_name);
        ArtistName = (TextView) itemView.findViewById(R.id.artist_name);
        menu = (ImageButton) itemView.findViewById(R.id.menu_button);
        backgroundColor = (LinearLayout) itemView.findViewById(R.id.backgroundColor);
        AlbumArtwork.setOnClickListener(this);
        itemView.setOnClickListener(this);
        itemView.findViewById(R.id.item_view).setOnClickListener(this);
    }
    if (layoutID == R.layout.item_list_view) {
        AlbumListArtwork = (CircleImageView) itemView.findViewById(R.id.album_artwork);
        AlbumListName = (TextView) itemView.findViewById(R.id.listalbumname);
        ArtistListName = (TextView) itemView.findViewById(R.id.listartistname);
        AlbumListArtwork.setOnClickListener(this);
        itemView.findViewById(R.id.item_view).setOnClickListener(this);
        itemView.setOnClickListener(this);
    }
}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:24,代碼來源:AlbumListAdapter.java

示例8: findview

import android.widget.ImageView; //導入方法依賴的package包/類
private void findview(View v) {
    mTextureView = (TextureView) v.findViewById(R.id.tv_textview);
    mButton = (Button) v.findViewById(R.id.btn_takepic);
    mThumbnail = (ImageView) v.findViewById(R.id.iv_Thumbnail);
    mThumbnail.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(getActivity(), "別戳了,那個頁麵還沒寫", Toast.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:lupwei,項目名稱:Croprotector,代碼行數:12,代碼來源:Shoot_fragment.java

示例9: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_routeplan);
        mTvtitle = (TextView) findViewById(R.id.tv_topbar_title);
        mTvtitle.setText("財神穀地址");
        ImageView img = (ImageView) findViewById(R.id.img_topbar_back);
        img.setImageResource(R.mipmap.icon_back);
        img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                RoutePlanDemo.this.finish();
            }
        });
//        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//獲取傳感器管理服務
        // 初始化地圖
        mMapView = (MapView) findViewById(R.id.map);
        mBaidumap = mMapView.getMap();
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.zoom(18.0f);
        builder.target(new LatLng(29.184662, 121.305024));
        mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build());
        mBaidumap.setMapStatus(mMapStatusUpdate);
        MarkerOptions ooA = new MarkerOptions().position(GEO_NINGBO).icon(bdA)
                .zIndex(9).draggable(true);
        mBaidumap.addOverlay(ooA);
        mBaidumap.setTrafficEnabled(true);
        findViewById(R.id.lin_action_route).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                go2ThirdMap();
            }
        });
    }
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:34,代碼來源:RoutePlanDemo.java

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

示例11: ItemHolder

import android.widget.ImageView; //導入方法依賴的package包/類
public ItemHolder(View itemView) {
    super(itemView);

    mIconImage = (ImageView) itemView.findViewById(R.id.listViewLeftIcon);

    mTitle = (TextView) itemView.findViewById(R.id.listViewTitleText);
    mSubTitle = (TextView) itemView.findViewById(R.id.listViewSubText);
    duration = (TextView) itemView.findViewById(R.id.listViewRightSubText);
    duration.setVisibility(View.INVISIBLE);

    mTitle.setTypeface(TypefaceHelper.getTypeface(itemView.getContext().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));
    mSubTitle.setTypeface(TypefaceHelper.getTypeface(itemView.getContext().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));

    mOverFlow = (ImageView) itemView.findViewById(R.id.listViewOverflow);

    mOverFlow.setOnClickListener(this);
    mOverFlow.setVisibility(View.VISIBLE);
    mOverFlow.setOnClickListener(this);
    itemView.setOnClickListener(this);

    RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) itemView.getLayoutParams();
    params.height = (int) mApp.convertDpToPixels(72.0f, mContext);
    itemView.setLayoutParams(params);

    mIconImage.setScaleX(0.55f);
    mIconImage.setScaleY(0.55f);

}
 
開發者ID:reyanshmishra,項目名稱:Rey-MusicPlayer,代碼行數:29,代碼來源:FolderAdapter.java

示例12: onCreateView

import android.widget.ImageView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_report, container, false);

    iv_menu = (ImageView) view.findViewById(R.id.iv_menu);
    iv_menu.setOnClickListener(this);
    textTitle = (TextView) view.findViewById(R.id.tvTitle);
    textTitle.setText(R.string.baobiao);
    btn_add = (Button) view.findViewById(R.id.btn_add);
    btn_add.setVisibility(View.INVISIBLE);

    webView = (WebView) view.findViewById(R.id.helpWebview);
    pbWebView = (ProgressBar) view.findViewById(R.id.pbWebView);
    ib_back = (ImageButton) view.findViewById(R.id.ib_back);
    ib_back.setOnClickListener(this);
    ib_back.setVisibility(View.INVISIBLE);
    ib_refresh = (ImageButton) view.findViewById(R.id.ib_refresh);
    ib_refresh.setOnClickListener(this);
    //啟用支持javascript
    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    settings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    getReportForm();

    return view;
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:30,代碼來源:ReportFragment.java

示例13: getLeftMenu

import android.widget.ImageView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
@Override
public View getLeftMenu(Activity activity) {
	ImageView iv = (ImageView) LayoutInflater.from(activity).inflate(R.layout.top_right_iv, null);
	iv.setImageResource(R.drawable.add);
	iv.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			onDragBottom(false);
		}
	});
	return iv;
}
 
開發者ID:TommyLemon,項目名稱:APIJSON-Android-RxJava,代碼行數:15,代碼來源:UserListFragment.java

示例14: initView

import android.widget.ImageView; //導入方法依賴的package包/類
private void initView() {
    StatusBarUtil.setTransparent(this);
    RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.root);
    mScrollLayout = (ScrollLayout) findViewById(R.id.scroll_down_layout);

    /**設置 setting*/
    mScrollLayout.setMinOffset(DisplayUtils.dp2px(this, 50));
    mScrollLayout.setMaxOffset(DisplayUtils.getScreenHeightPixels(this) - DisplayUtils.dp2px(this, 320));
    mScrollLayout.setIsSupportExit(false);
    mScrollLayout.setAllowHorizontalScroll(true);
    mScrollLayout.getBackground().setAlpha(0);
    relativeLayout.setOnClickListener(v -> mScrollLayout.scrollToExit());
    mLocation = (ImageView) findViewById(R.id.location);
    mLocation.setOnClickListener(this);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:PoiAroundSearchActivity.java

示例15: showImageViewDialog

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * show dialog for Google drive image
 */
private void showImageViewDialog() {
    int rotate = 0;
    String fileName = getFilesDir().getPath() + "/temp.jpg";
    try {
        ExifInterface exif = new ExifInterface(fileName);
        int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
        switch (exifOrientation) {
            case ExifInterface.ORIENTATION_NORMAL:      rotate = 0;     break;
            case ExifInterface.ORIENTATION_ROTATE_90:   rotate = 90;    break;
            case ExifInterface.ORIENTATION_ROTATE_180:  rotate = 180;   break;
            case ExifInterface.ORIENTATION_ROTATE_270:  rotate = 270;   break;
        }
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }

    // create bitmap from file
    Bitmap bitmap = BitmapFactory.decodeFile(fileName);
    if (bitmap == null) {
        return;
    }

    // rotate by orientation
    Matrix mat = new Matrix();
    mat.postRotate(rotate);
    bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), mat, true);

    // create dialog
    final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
    dialog.setContentView(R.layout.dialog_image_view);

    ImageView imageView = (ImageView) dialog.findViewById(R.id.image_view);
    imageView.setImageBitmap(bitmap);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });

    dialog.show();
}
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:47,代碼來源:SensorListActivity.java


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