[英]How can I add multiple linear layouts with imageviews dynamically?
I am trying to add images to my app based on a previously entered string. 我正在尝试根据先前输入的字符串将图像添加到我的应用程序。
This is for my final year project where I am going to take speech input from a user and present them with the BSL fingerspelling translation for their input. 这是我的最后一个项目,我将接受用户的语音输入,并向他们展示BSL拼写翻译。 Currently I am just trying to get the translation part working, the speech to text function can come later.
目前,我只是想使翻译部分正常工作,语音转文本功能可以稍后再发布。
I expect the app to be able to take my text input, break that down into individual characters, then check each character to see what letter it is and then display the corresponding image for that letter in the output window. 我希望该应用程序能够接受我的文本输入,将其分解为单个字符,然后检查每个字符以查看它是什么字母,然后在输出窗口中显示该字母的对应图像。 The images should be shown next to one another and start a new line automatically when the sequence reaches the end of the page.
图像应彼此相邻显示,并在序列到达页面末尾时自动开始新的一行。
You don't need a linear layout for this case. 在这种情况下,您不需要线性布局。 Try to using RecyclerView and grid layout manager if all your images views have the same size or StaggeredGridLayoutManager If your image views have different size.
如果所有图像视图的大小相同,请尝试使用RecyclerView和网格布局管理器;如果图像视图的大小不同,请尝试使用StaggeredGridLayoutManager。
Please, check this link: 请检查此链接:
https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager
Welcome to the Android world. 欢迎来到Android世界。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.