极其简单的 Android 布局
我知道这一定很简单。但这让我抓狂。我已经尝试了很多废话来让这个看起来不错,但没有任何效果! :/
这是我的问题:
我希望布局看起来像这样:
固定标题,其高度与左侧的图像相同。在图像的右侧,我只想要可以跨越 2 行的简单文本。
在固定标题下方,我需要某种表格布局,例如:
----------------------------------
Birth date | 09/23/1945
----------------------------------
Death date | 04/27/2011
----------------------------------
等。
在这些行中的任何一行中,文本可能跨越 2 行,具体取决于数据库中的内容。第一列中的文本都是静态的,而第二列中的文本是动态的。表行需要放入 ScrollView 中(简单部分),以便它可以容纳大量信息。我尝试过使用 TableLayout,但它一直让我感到各种头痛。另外,对于固定标题,我使用了整个RelativeLayout以及layout_below和above来使其工作,但我无法正确获取图像间距和文本。真是头疼啊!感谢您的帮助!
I know this HAS to be simple. It's making me crazy though. I've tried so much crap to get this looking good and NOTHING IS WORKING!! :/
Here is my problem:
I want a layout to look like this:
A fixed header with a height the same as an image that is put on the left. To the right of the image, I want just simple text that has the possibility of spanning 2 lines.
Below the fixed header, I need some sort of table layout like:
----------------------------------
Birth date | 09/23/1945
----------------------------------
Death date | 04/27/2011
----------------------------------
etc.
In any one of those rows, the text may span 2 lines depending on what is in the database. The text in the first column is all static while the text on the second column is dynamic. The table rows need to be put into a ScrollView (easy part) so it can hold a lot of information. I've tried using a TableLayout and it has been giving me all sorts of headaches. Also for the fixed header, I used the whole RelativeLayout thing with layout_below and above to make that working but I can't get the image spacing and the text to the right correct. It's such a headache! Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我并不 100% 理解它应该是什么样子,但请记住,您可以嵌套布局,因此您可以使用类似的内容,
如果您提供有关您遇到的问题的更多信息,也许我可以提供更多帮助。
[编辑] ...或者正如 bigstones 在他的评论中所说 - 除了表之外,您还可以使用带有自定义适配器的 ListView,这可能是更好的解决方案:)
Well, I do not understand 100% how it's supposed to look, but remember that you can nest layouts, so you can use something like
Maybe I can help more if you give a bit more information about problems you're encountering.
[EDIT] ...or as bigstones says in his comment - instead of table you can use ListView with a custom adapter, that's probably much better solution :)
这就是我所做的。
row.xml
主应用
Here's what I do.
row.xml
Main App