如何将图像按钮合并到 Android 应用程序中的图像视图中
我正在开发一个适用于 ios 和 android 的应用程序。在一个特定的活动中,我显示了一个充满文本的图像视图。我用黄色突出显示特定文本。当用户点击它们时,他会进入一个网页。
特定文本位于图像的中间和末尾。为此,在我的 ios 应用程序中 我得到的图像之间有一个空白,在这些空白中我添加了一个图像按钮,这样当用户单击它时就会打开网页。在ios中,应用程序的分辨率是固定的。
我这里还有一个问题。如果用户当前将其语言更改为德语或韩语,我将在 ios 应用程序中使用相应的文本更改图像,但在这里我必须使用这些语言创建文本。我觉得这很难,这就是为什么我尝试使用图像本身......
但是我怎样才能在我的 Android 应用程序中做到这一点。任何人都可以帮助我吗?
i am working on an app for both ios and android. In a particular activity i am showing an imageview full of text. In that i am highlighting particular text with yellow color. When the user clicks over them it takes him to a webpage.
The particular text is been at the middle and at the end of the image. For this in my ios app
i got the image with a blank space in between and in those blank spaces i have added an image button, so that when the user clicks it opens the web page. In ios the resolution of the app is to be a fixed one.
i have one more problem here. If the user changes his language to be german or korean currently i am changing the images with the corresponding text in my ios app, but here i have to create text in those language. I felt it to be very hard, tats why i am trying to use image itself....
But how can i do this in my android app. Can anyone help me in this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不需要在 ImageView 中显示图像,我建议使用 TextView 代替。您可以将所有文本放入 TextView 中,并使用 android:autoLink="all" 属性,所有指向网页、电话号码、地图和电子邮件的链接都将突出显示!另外,您还可以设置背景图像或背景渐变
这是 main.xml 的示例
这是背景渐变的代码(您应该将其放入可绘制文件夹中):
If you do not need to show an image in the ImageView, I suggest to use a TextView instead. You can put all your text in the TextView, and with the android:autoLink="all" attribute, all links to webpages, phonenumbers, maps and email will be highlighted! Also, you can set a background image or background gradient
Here's an example for your main.xml
Here's the code for the background gradient (which you should put in the drawables folder):
我不确定我完全理解你的问题,但听起来你可以使用由文本图像文本构建的 SpannableString 并设置为 TextView 来做到这一点
I am not sure I understand your question completely, but it sounds like you can do it using
SpannableString
built of text-image-text and set to aTextView