当前位置: 首页>>代码示例>>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;未经允许,请勿转载。