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

Android Year Month and Time Zone
Does jayway maven plugin option <manifestVersioncode> really works for Android app?
Intent/action from notification not passed on when user clicks on notification
set orientation portrait phonegap android
Android custum listview layout issue
Android JNI Using Pre built .so file in C Code
Open Activity with backwards to MainActivity in my app
Problems Adding TextView Programmatically Without Erasing Views in XML - Android
ndk-build: Header file of static prebuilt static library not found even on LOAD_STATIC_LIBRARY
Android studio. Module not specified after import
Android Java getId() name not int value [duplicate]
Ntlm code works on only Samsung devices
Webview - open links in external apps and browsers / android
alarm never triggers , as it should do android
Enabling GPS programmatically, causes the GPS indicator to flash while the GPS button is disabled
Android SQL lite table insert issue

Categories

HOME
shell
sonarqube
url-redirection
django
beautifulsoup
phantom-dsl
eclipse
gridview
jmx
interface
cakephp-3.4
interpolation
hpc
x264
missing-data
nfs
line
selenium-ide
enterprise-architect
qsqlquery
nim
sencha-touch
ag
qliksense
jquery-callback
xunit
ckfinder
fable-f#
ms-access-web-app
mat
inversion-of-control
quantlib
gp
scrollview
aws-codecommit
dsx-desktop
raft
nohup
amazon-ses
skylink
placeholder
show-hide
jide
mesosphere
jboss-4.2.x
proget
term
reportservice2010
datamaps
remedy
corruption
arq
java-websocket
google-photos
ampps
simplepie
signalr.client
jclouds
dbamp
pypiserver
fuelcms
slash
sony-lifelog-api
lasso
omnifaces
xmltype
apache-spark-1.3
sql-scripts
cuba
verold
codeplex
lnk
ios8-extension
vbe
synapse
windows-embedded-standard
http-patch
cmmi
abstract-data-type
pagedown
traceability
argouml
dopostback
correlated-subquery
koken
box2d-iphone
relative
catransform3d
u2netdk
collectionviewsource
updatesourcetrigger
interprocess
request-headers
cfwindow
xpsdocument
leader

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App