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

Pause on App Launch with AppCompatActivity for preview screen before splash screen appears
Android RX need synchronous execution of two different processes
Unable to plot marker in the map
How to solve java.lang.RuntimeException: Performing stop of activity that is not resumed
Adding headers to jsonArrayRequest using Volley Android
how change RecyclerView's item's background
Unable to solve Error inflating class for NavigationView
Integrating Firebase in the app: “Could not find com.google.firebase:firebase-core:9.6.1”
Determine space occupied by the text in a given width in android
How to increase text size of Preference Category
Querying middle data in Firebase
Ionic App Live Reload on Android Device Fails: connection to the server was unsuccesful
Sending file and String value making error in Retrofit 2.0
UI elements does not update when they should
Xamarin.Auth not completed
Android DataBinding & MVVM - Using same layout files for different conditions using same view models

Categories

HOME
localization
turing-machines
jpa
cheerio
pda
requirements
sublimetext
bitbucket-api
big-o
3d-reconstruction
interpolation
polling
mel
project-intu
favicon
http-post
azure-iot-hub
scsi
forgot-password
google-data-studio
database-connection
visual-studio-extensions
comparator
ckfinder
android-sharedpreferences
android-maps
8051
r-grid
hreflang
vue-chartjs
fossil
jwplayer6
sharepoint-workflow
watchman
jpad
password-protection
verifiable-c
metawidget
apache-stanbol
stringtokenizer
dbnull
tcc
contract
xbmc
automapper-5
user-defined-fields
podscms
boxing
java-6
jqchart
reshape
mach-o
objectscript
juice-ui
change-tracking
custom-lists
spring-cloud-feign
tooleap
lean
pre-build-event
swizzling
mediametadataretriever
bizagi
exim4
vhosts
qt5.2
themoviedb-api
binomial-theorem
ms-access-2000
fail2ban
jquery-forms-plugin
user-permissions
umlgraph
code-documentation
adehabitathr
angular-gettext
sql-scripts
rmysql
ray
ios8-extension
draw2d-js
paste
radiant
eclipse-kepler
mongohq
epiceditor
css-reset
insert-id
device-width
pdfviewer
dopostback
adobe-media-server
httponly
ilasm
wiimote
jquery-address
relative
u2netdk
xcelsius
drawtobitmap
appledoc
maven-1
object-database
murmurhash
wcf-instancing
fault-tolerance
firefox-3

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