StackAsk is a community where developers ask questions, share answers and learn from each others real-world experience, so every solved problem helps the next person who runs into it.
val mImageView = findViewById<ImageView>(R.id.image_view_1) val mButton = findViewById<Button>(R.id.button_1) val tv1 = findViewById<View>(R.id.textView) val tv2 = findViewById<View>(R.id.textView2) val currentDisplay = windowManager.currentWindowMetrics val dw = currentDisplay.bounds.width() val dh = currentDisplay.bounds.height() val mBitmap = Bitmap.createBitmap(dw, dh, Bitmap.Config.ARGB_8888) val mCanvas = Canvas(mBitmap) mImageView.setImageBitmap(mBitmap) mButton.setOnClickListener { val mPaint = Paint() mPaint.color = Color.GREEN mPaint.style = Paint.Style.STROKE mPaint.strokeWidth = 10F mPaint.isAntiAlias = true val mStartX = tv1.bottom.toFloat() val mStartY = tv1.left.toFloat() val mStopX = tv2.top.toFloat() val mStopY = tv2.right.toFloat() mCanvas.drawLine(mStartX, mStartY, mStopX, mStopY, mPaint) mImageView.setImageBitmap(mBitmap) }
2.2K Point(s)
1.2K Point(s)
313 Point(s)
178 Point(s)
138 Point(s)
Input your email to receive reset password link, or if you remember your password, you can click