android


Move Android bitmap/canvas away from the top left


I'm trying to customize some code to capture a signature for my use. I am new to this stuff and I can't figure it out.
The following code does the job, but the canvas/bitmap is positioned at the top left corner. I want it somewhere around the upper center part of the page. I tried to mess around with the drawBitmap parms "canvas.drawBitmap(mBitmap, 0, 0, null)", but it actually creates an offset between the stylus and the actual path drawn on the tablet.
Canvas canvas = null;
while (_run) {
if (isDrawing == true) {
try {
canvas = mSurfaceHolder.lockCanvas(null);
if (mBitmap == null) {
mBitmap = Bitmap.createBitmap(300, 200, Bitmap.Config.ARGB_8888);
}
final Canvas c = new Canvas(mBitmap);
c.drawColor(0, PorterDuff.Mode.CLEAR);
canvas.drawColor(0, PorterDuff.Mode.CLEAR);
commandManager.executeAll(c, previewDoneHandler);
previewPath.draw(c);
// Rect targetRect = new Rect(0, 0, 300, 200);
// canvas.drawBitmap(mBitmap, null, targetRect, null);
canvas.drawBitmap(mBitmap, 0, 0, null);
} finally {
mSurfaceHolder.unlockCanvasAndPost(canvas);
Is the a way to move the bitmap/canvas to a position other than the top left corner? Thanks for any help.
The way I resolved it was by adding the layout_marginLeft and layout_marginTop to my custom view in the xml layout.

Related Links

Performing network calls in activity before creating fragment
Firebase database offline capability
Momentary blinking of background image set with databinding in android
Validating Edit text input with regex
Exception while sending file using smack Android
Why does Gradle connectedDebugAndroidTest depend on validateSigningRelease?
Efficient way of handling percentile chance of event in programmatic way
Kivy: Bad Audio Management
unity3d video player unresolved class
Call recording - make AudioSource.VOICE_DOWNLINK work on Nexus 5X (rooting or custom ROM possible)
How to sort values arraylist<hashmap<string,string>>
Unable to access file from uri
How i can remove android.permission.CAMERA from cordova build?
Many to Many Relationship in SQLite Database - Crashes Application
Relative layout changes the coordinates of imageview
android: why 'Place Autocomplete Fragment' not function after update version on play-services-location 8 to 10

Categories

HOME
gridview
prism
nvd3.js
pagination
access
simulink
cakephp-3.4
pyqt4
hugo
sendgrid-api-v3
octave
siddhi
opengl-es-3.0
comsol
magnetic-cards
searchview
google-data-studio
xmonad
asp.net-core-webapi
articulate-storyline
ksh
cgbitmapcontext
angular-routing
strongname
corpus
angularjs-components
handler
quantlib
iis-express
realm-mobile-platform
volatile
utorrent
weather
jett
installshield-le
lubridate
video-capture
docfx
wurfl
android-augmented-reality
hackintosh
xv6
doc
android-ibeacon
congestion-control
outputcache
avcapturedevice
drupal-theming
memory-mapping
dapper-simplecrud
monkey-testing
nanoc
proget
dtsearch
tf
arq
yii2-user
oracleclient
cpu-cache
rxtx
filenet
cvxpy
pacemaker
tooleap
android-dateutils
eigenvector
refinerycms
bizagi
nullable
thread-sleep
kendo-upload
atan2
wiredep
ess
intel-c++
canalyzer
finalbuilder
zscript
sql-server-data-tools
rrule
umlgraph
code-documentation
mass-assignment
at-job
crowd
machine-instruction
cbind
jama
jjaql
tinyxml
jquery-slider
ios8-extension
spring-remoting
file-not-found
cfcache
synapse
accesscontrolexception
visual-studio-express
eclipse-kepler
mbunit
printdialog
mvc-editor-templates
superscrollorama
stacky
panda3d
qtconcurrent
os.system
iboutlet
listitem
objectquery
thttpd
koken
jsr286
stress
google-maps-mobile
fsevents
pylucene
multiplatform
inline-formset
easyb
dot-emacs
zend-rest
echo3

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