Click on image android

Android – ImageView On Click

Я пытаюсь проследить щелчок при щелчке по моему изображению, но я не могу понять, какие идеи?

Изображения обычно не доступны для кликов, поэтому я бы предположил, что вы указали определение

в вашем layout.xml для изображения.

Если это не помогает, отредактируйте + обновите свой вопрос и покажите нам часть вашего макета, где вы определяете изображение, чтобы посмотреть на него.

EDIT:
Пробовал это, и ваш код работал со мной тоже – даже с идентификатором верхнего регистра.
Не могли бы вы внимательно посмотреть на свой LogCat?
Моя иногда не обновляется, пока я не выбираю устройство снова.

Чтобы сделать это в Eclipse, перейдите в “Устройства” (или покажите его сначала через “Окно” ) и щелкните один раз на своем устройстве/виртуальном устройстве.

Если вы еще не нашли свою запись в LogCat-View, попробуйте создать фильтр (с помощью зеленого плюса и присвоив ему строку, которую вы определили с помощью TAG как “по тегу журнала” ).

Взгляните на разработчиков Android > Использование DDMS в разделе “Использование LogCat”

Вы забыли переопределить метод onClick. Это работает для меня и должно делать для вас: -)

Здесь для получения координат X и Y:

1) Сначала сделайте свое изображение доступным, добавив- > андроид: clickable = “true”.
2) Затем перейдите в свой java файл и добавьте объявление переменной
например, → private static ImageView imgview;
3) Затем добавьте эту функциональность:

и вызовите эту функцию в конструкторе.
Надеюсь, это сработает.

Источник

Click on image android

TouchImageView for Android

TouchImageView extends ImageView and supports all of ImageView’s functionality. In addition, TouchImageView adds pinch zoom, dragging, fling, double tap zoom functionality and other animation polish. The intention is for TouchImageView to mirror as closely as possible the functionality of zoomable images in Gallery apps.

Читайте также:  Super mario bros the lost levels android

Please view the sample app which includes examples of the following functionality:

Basic use of a single TouchImageView. Includes usage of OnTouchImageViewListener , getScrollPosition() , getZoomedRect() , isZoomed() , and getCurrentZoom() .

TouchImageViews placed in a ViewPager like the Gallery app.

Mirror two TouchImageViews using onTouchImageViewListener and setZoom() .

Switch Image Example

Click on TouchImageView to cycle through images. Note that the zoom state is maintained though the images are switched.

Switch ScaleType Example

Click on TouchImageView to cycle through supported ScaleTypes.

Click on the arrow buttons to change the shape and size of the TouchImageView. See how the view looks when it shrinks with various «resize» settings. Read ChangeSizeExampleActivity.java’s comment for advice on how to set up a TouchImageView that’s going to be resized.

TouchImageView does not yet support pinch image rotation. Also, FIT_START and FIT_END scaleTypes are not yet supported.

Get the current zoom. This is the zoom relative to the initial scale, not the original resource.

Get the max zoom multiplier.

Get the min zoom multiplier.

Return the point at the center of the zoomable image. The PointF coordinates range in value between 0 and 1 and the focus point is denoted as a fraction from the left and top of the view. For example, the top left corner of the image would be (0, 0). And the bottom right corner would be (1, 1).

Return a RectF representing the zoomed image.

Returns false if image is in initial, unzoomed state. True , otherwise.

Reset zoom and translation to initial state.

Set the max zoom multiplier. Default value is 3.

Set the min zoom multiplier. Default value is 1. Set to TouchImageView.AUTOMATIC_MIN_ZOOM to make it possible to see the whole image.

Читайте также:  Сбербанк плей для андроид

Set the max zoom multiplier to stay at a fixed multiple of the min zoom multiplier.

Set the focus point of the zoomed image. The focus points are denoted as a fraction from the left and top of the view. The focus points can range in value between 0 and 1.

Set zoom to the specified scale. Image will be centered by default.

Set zoom to the specified scale. Image will be centered around the point (focusX, focusY). These floats range from 0 to 1 and denote the focus point as a fraction from the left and top of the view. For example, the top left corner of the image would be (0, 0). And the bottom right corner would be (1, 1).

Set zoom to the specified scale. Image will be centered around the point (focusX, focusY). These floats range from 0 to 1 and denote the focus point as a fraction from the left and top of the view. For example, the top left corner of the image would be (0, 0). And the bottom right corner would be (1, 1).

Set zoom parameters equal to another TouchImageView . Including scale, position, and ScaleType .

Set which part of the image should remain fixed if the TouchImageView is resized.

Set which part of the image should remain fixed if the screen is rotated.

TouchImageView is available under the MIT license. See the LICENSE file for more info.

About

Adds touch functionality to Android ImageView.

Источник

Click on image android

An open-source auto clicker on images for Android

Smart AutoClicker is an Android application allowing to automate repetitive task by clicking automatically for you on the screen. Unlike the regular auto clicker application, the clicks aren’t based on timers to execute the clicks. Instead, it allows you to capture an image from a part of your screen and execute the click once this image is detected again.

Читайте также:  Как выбрать пауэр банк для андроид

  • Organize clicks by scenario
  • Execute clicks or swipes
  • Add an image condition from the screen
  • Modify the tolerance for the condition detection
  • Combine multiple conditions
  • Configure the delay before the next click
  • Modify the prority order of a click

About

An open-source auto clicker on images for Android

Источник

Оцените статью