简体   繁体   English

如何动态添加带有图像视图的多个线性布局?

[英]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.

相关问题 如何将使用XML布局的视图动态添加到ContentView? - How can I dynamically add Views that use XML Layouts to the ContentView? 如何动态地将ImageViews添加到视图 - How to add ImageViews to a View, dynamically 如何将4个线性布局锚定到线性布局的底部? - How can I anchor 4 linear layouts to the bottom of a linear layout? 如何管理动态创建的imageView之间的差距? - How can I manage the gap between dynamically created imageViews? 如何在scrollview中添加多个图像视图? - how to add multiple imageviews in scrollview? 如何以编程方式将多个ImageView添加到Framelayout? - How do I programmatically add multiple ImageViews to a Framelayout? 如何将多个图像视图拖放到其他图像视图android上 - How can i drag and drop multiple imageviews over other imageviews android 如何在ListView中的项目旁边添加ImageViews? - How can i add ImageViews next to items in my ListView? 在Android上动态添加imageViews - Add imageViews dynamically on Android 我有多个线性布局,如何一次更改某些或所有背景,然后又一次更改它们,等等? - I have multiple linear layouts, how can I change some or all of the backgrounds at one time, then change them again, and again etc?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM