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


Java ImageView.setOnLongClickListener方法代碼示例

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


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

示例1: initViews

import android.widget.ImageView; //導入方法依賴的package包/類
private void initViews() {
	TextView tvInfo1 = (TextView)findViewById(R.id.info);
	memberLayout = (LinearLayout)findViewById(R.id.about_memberLayout);
	teamLogo = (ImageView)findViewById(R.id.about_teamLogo);
	btnEmail = (Button)findViewById(R.id.email);
	btnEmail.setOnClickListener(this);
	btnQQ = (Button)findViewById(R.id.about_btnQQ);
	btnQQ.setOnClickListener(this);
	llytSinaWeibo = (LinearLayout)findViewById(R.id.about_llytSinaWeiBo);
	llytSinaWeibo.setOnClickListener(this);
	tvSinaWeibo = (TextView)findViewById(R.id.about_sinaWeiBo);
	
	String strInfo1 = "應用版本:V"+MyUtils.getVersionName(this);
	tvInfo1.setText(Html.fromHtml(strInfo1));
	String strEmail = "[email protected]";
	btnEmail.setText(Html.fromHtml("<u>聯係郵箱: "+strEmail+"</u>"));
	btnEmail.setTag(strEmail);
	btnQQ.setText(Html.fromHtml("<u>" + strQQ + "</u>"));
	tvSinaWeibo.setText(Html.fromHtml("<u>@"+strSinaWeibo+"</u>"));
	teamLogo.setOnLongClickListener(new View.OnLongClickListener() {
		@Override
		public boolean onLongClick(View v) {
			memberLayout.setVisibility(memberLayout.isShown() ? View.GONE : View.VISIBLE);
			return false;
		}
	});
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:28,代碼來源:AboutAty.java

示例2: onCreateView

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

    ImageView imageView = (ImageView) rootView.findViewById(R.id.image);
    String url = getData();
    if(url.toLowerCase().endsWith(".gif")) {
        Glide.with(this).load(url).asGif().into(imageView);
    } else {
        Glide.with(this).load(url).into(imageView);
    }
    imageView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            SaveImageDialogFragment.show(getActivity(), getData());
            return true;
        }
    });

    return rootView;
}
 
開發者ID:stone100,項目名稱:SaveImage2SystemAlbum,代碼行數:23,代碼來源:ImageFragment.java

示例3: onCreateView

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

    ImageView imageView = (ImageView) view.findViewById(R.id.nav_drawer_image);
    imageView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            Toast.makeText(getActivity(), "Thanks for downloading the app! Developed by Trinity Infotech Committee.", Toast.LENGTH_LONG).show();
            return true;
        }
    });

    return view;
}
 
開發者ID:Ronak-59,項目名稱:Trinity-App,代碼行數:17,代碼來源:NavDrawerFragment.java

示例4: onFinishInflate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mAllAppsHandle = (ImageView) findViewById(R.id.all_apps_handle);
    mAllAppsHandle.setImageDrawable(getCaretDrawable());
    mAllAppsHandle.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
    mAllAppsHandle.setOnClickListener(mLauncher);
    mAllAppsHandle.setOnLongClickListener(mLauncher);
    mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler);
    mLauncher.setAllAppsButton(mAllAppsHandle);
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:12,代碼來源:PageIndicatorLineCaret.java

示例5: onCreate

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

    // litepal
    Connector.getDatabase();

    // 獲得包名和資源,方便後麵的程序使用
    PACKAGE_NAME = getApplicationContext().getPackageName();
    resources = getResources();

    showBtn = (Button) findViewById(R.id.show_money_button);
    addBtn = (CircleButton) findViewById(R.id.add_button);
    ioItemRecyclerView = (RecyclerView) findViewById(R.id.in_and_out_items);
    headerImg = (ImageView) findViewById(R.id.header_img);
    monthlyCost = (TextView) findViewById(R.id.monthly_cost_money);
    monthlyEarn = (TextView) findViewById(R.id.monthly_earn_money);

    // 設置按鈕監聽
    showBtn.setOnClickListener(new ButtonListener());
    addBtn.setOnClickListener(new ButtonListener());

    // 設置首頁header圖片長按以更換圖片
    headerImg.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            selectPictureFromGallery();
            return false;
        }
    });

    setImageForHeader();
}
 
開發者ID:yuukidach,項目名稱:Ucount,代碼行數:36,代碼來源:MainActivity.java

示例6: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_set_image);
	Preferences.makeAppFullscreen(this, Color.TRANSPARENT);
	
	setEnter();
	if (savedInstanceState != null) 
	{
           image = savedInstanceState.getString(URL);
           title = savedInstanceState.getString(NAME);
		text = savedInstanceState.getString(TEXT);
       }
	
	Bundle bundle = getIntent().getExtras();
       if (bundle != null)
	{
           image = bundle.getString(URL);
           title = bundle.getString(NAME);
		text = bundle.getString(TEXT);
       }
	
	wallpaper = (DoubleTapImageView)findViewById(R.id.id_image);
	progress = (ProgressBar)findViewById(R.id.id_progress);
	apply = (ImageView)findViewById(R.id.id_apply);
	
	mColor = Preferences.getAttributeColor(this, R.attr.colorAccent);
	anim = AnimationUtils.loadAnimation(this, R.anim.slide_left_from_right);
	_anim = AnimationUtils.loadAnimation(this, R.anim.slide_right_from_left);
	
	exitTransition = ActivityTransition.with(this.getIntent())
	    .to(this, wallpaper, "walls")
	    .duration(300)
	    .start(savedInstanceState);
	
	apply.setOnLongClickListener(applyLongClick);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:39,代碼來源:ActivitySetWallpapers.java

示例7: VideoPhotoPostVH

import android.widget.ImageView; //導入方法依賴的package包/類
public VideoPhotoPostVH(View itemView, ExoPlayerInstance playerInstance) {
    super(itemView);
    playerView = (CommonExoPlayerView) itemView.findViewById(R.id.post_video);
    playerView.setPlayerInstance(playerInstance);
    playerView.setOnClickListener(this);
    downloadView = (ImageView) itemView.findViewById(R.id.post_download);
    downloadView.setOnClickListener(this);
    downloadView.setOnLongClickListener(this);
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:10,代碼來源:VideoPhotoPostVH.java

示例8: createBtnAndSetFunc

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * 創建按鈕並且設置對應功能
 *
 * @param line
 * @param sc
 */
public void createBtnAndSetFunc(LinearLayout line, ShortCut sc) {
    int iconScale = DataHook.iconScale;
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    p.weight = 1;
    p.gravity = Gravity.CENTER;

    Context context = line.getContext();
    ImageView btn = new ImageView(context);

    String iconPath = sc.getIconPath();
    Bitmap iconBitmap = null;
    if (iconPath != null) {
        iconBitmap = ImageUtil.zoomBitmap(iconPath, iconScale);
    }
    if (iconBitmap == null) {
        iconBitmap = ImageUtil.byte2Bitmap(mMapImgRes.get(sc.getCode()));
        iconBitmap = ImageUtil.zommBitmap(iconBitmap, iconScale);
    }
    btn.setImageBitmap(iconBitmap);

    ColorStateList colorStateList = createColorStateList(0xffffffff, 0xffffff00, 0xff0000ff, 0xffff0000);
    RippleDrawable ripple = new RippleDrawable(colorStateList, null, null);
    btn.setBackground(ripple);
    btn.setScaleType(ImageView.ScaleType.CENTER);
    btn.setOnClickListener(getBtnFuncOfName(sc));
    btn.setOnLongClickListener(getBtnLongFuncOfName(sc.getCode()));

    line.addView(btn, p);
}
 
開發者ID:EggUncle,項目名稱:XposedNavigationBar,代碼行數:37,代碼來源:BtnFuncFactory.java

示例9: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.dialog_wallpaper_choice_options);
	Preferences.makeAppFullscreen(this, Color.TRANSPARENT);
	
	container = (ViewGroup)findViewById(ids[1]);
	if (!CircularRevealTransformEnter.setup(this, container))
	{
		MorphTransform.setup(this, container, ContextCompat.getColor(this, R.color.white), getResources().getDimensionPixelSize(R.dimen.dialog_corners));
	}
	
	if (savedInstanceState != null) 
	{
           image = savedInstanceState.getString(URL);
           title = savedInstanceState.getString(NAME);
		text = savedInstanceState.getString(TEXT);
		colorPalette = savedInstanceState.getInt(COLOR);
       }

	Bundle bundle = getIntent().getExtras();
       if (bundle != null)
	{
           image = bundle.getString(URL);
           title = bundle.getString(NAME);
		text = bundle.getString(TEXT);
		colorPalette = bundle.getInt(COLOR);
       }
	
	window = (LinearLayout)findViewById(ids[0]);
	apply = (ImageView)findViewById(ids[2]);
	apply.setImageDrawable(DrawableHelper.getTintedDrawable(ActivityDialogWallpaperChoiceOptions.this, R.drawable.ic_check_circle_accent_24dp, colorPalette));
	
	save = (ImageView)findViewById(ids[3]);
	save.setImageDrawable(DrawableHelper.getTintedDrawable(ActivityDialogWallpaperChoiceOptions.this, R.drawable.ic_save_accent_24dp, colorPalette));
	
	window.setOnClickListener(this);
	container.setOnClickListener(this);
	apply.setOnClickListener(this);
	save.setOnClickListener(this);
	apply.setOnLongClickListener(this);
	save.setOnLongClickListener(this);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:45,代碼來源:ActivityDialogWallpaperChoiceOptions.java


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