Add text to image in android programmatically(以编程方式将文本添加到android中的图像)
问题描述
我想制作一个应用程序,就像 android 的打开屏幕一样.我正在动态地将图像添加到 tableLayout 的行中.我只在 xml 文件中定义了 tableLayout,其余代码在 java 中.我已成功添加图像,但在设置该图像的文本(我想在图像下显示文本)和图像设置为特定填充方面没有任何帮助.如何做到这一点?提前致谢.
I want to make an application just like opening screen of android.I am dynamically adding images to the rows of tableLayout. I have only defined tableLayout in xml file and remaining code is in java. I have added images successfully but i am not getting any help with setting text of that image (I want to display a text under image) and image to be a specific padding.How to do it?Thanks in advance.
推荐答案
您可以做的是使用RelativeLayout 将TextView 叠加到ImageView :)
What you can instead do is to put a TextView in overlay to a ImageView using a RelativeLayout :)
这篇关于以编程方式将文本添加到android中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式将文本添加到android中的图像
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
