I'm porting an app written in a graphics environment that allows drawing to happen outside the bounds of the clipping rectangle. Any way to do this in Android?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can draw where you like, but nothing will be saved outside the clipping rectangle.
If you want to draw text out of bounds in TextView, you should be doing this instead:
It's not working to use clipRect() like @numan's answer because TextView clip it's own rect in onDraw():
Last but not least, Don't forget to set
android:clipChildren="false"
andandroid:clipToPadding="false"
in your parent ViewGrouptry to set
to the parent view
The answer @numan gave is almost ok, the problem is memory allocation with that approach, so we should be doing this, instead:
That solves the problem :-)
To draw outside the bounds, you need to expand the clipRect of the canvas.
Check out the overloaded clipRect methods on the Canvas class.
Note - You will need to specify the Region operation because the default operation is INTERSECT. So something like this: