android


Moving of Screen


I want to have a layout (kind doesn't matter) that ia acctual size will be bigger from the real size of the screen multiplies by 5. I have created a surfesview which takes the canvas and draws what I want, but how can I move the screen by touch so I will be able to see every part of the screen? How can I be able to know what view haas been clicked (I want something will happen onClick)?
It seems to me that you would want to use a OnTouchListener or the View.onTouchEvent(MotionEvent ev) to detect touches and act appropriately:
For example:
myView.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_UP:
// Perform click operation
return true;
case MotionEvent.ACTION_MOVE:
// Move to another area based on the event
return true;
}
return false;
}
});
Or inside your class:
int downX = -1;
int downY = -1;
public boolean onTouchEvent(MotionEvent event) {
int eventAction = event.getAction();
// You may need the x/y location
int x = (int)event.getX();
int y = (int)event.getY();
// put your code in here to handle the event
switch (eventAction) {
case MotionEvent.ACTION_DOWN:
downX = x;
downY = y;
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
downX = -1;
downY = -1;
// decide what to do here about movement
break;
case MotionEvent.ACTION_MOVE:
int deltaX = x - downX;
int deltaY = y - downY;
// This is one way of doing it, it might not be exactly what you want, but you can start from her
setTranslationX(getTranslationX() + deltaX);
setTranslationY(getTranslationY() + deltaY);
break;
}
return true;
}

Related Links

Cannot build APK file using Intel XDK (Build 3900)
How Android Saving Files?
Using UIAutomator to test third party APK
SECUGEN sdk matching the every finger template
How to make scrolling viewpager contunuously with hold?
Nearby Connections NullPointerException
Check if internet connection is available [duplicate]
React-native-image-picker doesn't launch gallery when i select the option
Room finder using closest Beacon device
CURL -F request with Retrofit2
After installing latest version of android studio 2.3 , this error occurs
Android 6.0 : UsageEvents method 'usageStatsManger.queryEvents()' is giving count 0 (zero)
Connect to Android over WiFi with no IP address from WinForms
Difference between the classes BrowseFragment and BrowseSupportFragment?
How to getView of fragment extended with another class?
How to read more than 23 byte on Android BLE

Categories

HOME
xml
awk
string
redux-form
pda
toolbox
camera
socket.io
nuget
soa
aws-cli
google-apps
cq5
data-visualization
vert.x
performancepoint
accessibility
octave
project-intu
filechannel
shared-libraries
zerobrane
enterprise-architect
eip
modbus-tcp
google-container-registry
database-connection
lilypond
dataflow-diagram
hta
short-url
siri
stackexchange
motion-detection
licensing
asymptotic-complexity
oculus
8051
watchman
visa
ovf
opennms
convex-optimization
static-cast
headless
libjpeg
template-toolkit
materialized-path-pattern
cubism.js
pytables
jboss-tools
ng-grid
vorpal.js
http-status-code-401
freepbx
query-by-example
piracy-prevention
xvim
baasbox
linked-tables
phpldapadmin
at-job
easyrtc
iso-prolog
entry-point
psr-4
linkedin-jsapi
imagefilter
named-parameters
parallel-testing
authlogic
dsym
menubar
multitasking
scriptaculous
mbunit
printdialog
beaker-testing
cffile
cnf
windows-98
web-notifications
redis-py
patricia-trie
listitem
paginator
node-redis
multiplatform
updatesourcetrigger
maven-1
glui
escrow
xpsdocument
ifilter
wcf-proxy
blind

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App