How can I make a text with texture instead of text color or gradient(for example png file)? Something like this. I understand the logic, that I should make text color transparency and put under the text bitmap. I think I can't achive this with a Textview
. And I don't know how to do it with a canvas or OpenGL. Any ideas please?
相关问题
- 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不能创建表
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- 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
this is a snippet from http://teamyoda.wordpress.com/2012/07/23/drawing-text-in-opengl-for-android/ - Answer from JVitela
Here's a way of doing it using
PorterDuffXfermode
.The layout is pretty simple:
This code with write text using
canvas.drawText()
. If you want to use a regularTextView
, you can:TextView
TextView
into a canvas usingtextView.draw(canvas);
canvas.drawText()
usecanvas.drawBitmap()
Sorry for posting this late but I think I will be helpful. So to make a textured text, say for example you have a file named my_layout.xml in your layout/ folder that is defined like this :
and in your drawable/ folder you have a picture named texture.png, you just reference in your java code (say in the class MainActivity for instance) this way :