本文整理汇总了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;
}
});
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}