简体   繁体   English

android ListView替换ScrollView

[英]android ListView replacement for ScrollView

I have a complex layout file with many TextView's and EditText's placed on the canvas. 我有一个复杂的布局文件,在画布上放置了许多TextView和EditText。 The layout needs to be a ScrollView in order to properly work for the user. 布局必须是ScrollView才能正确地为用户工作。 The problem is that 2 fields should really be ListView's with all the formatting that comes with them. 问题是2个字段实际上应该是ListView的所有格式。 Neither of these lists will be more then 10 lines long. 这些列表的长度都不会超过10行。 I am currently using a TextView by creating a long string from the data and displaying it. 我目前正在通过从数据创建一个长字符串并显示它来使用TextView。

The problem is that I cannot format the text in the TextView like I can within a ListView. 问题是我无法像在ListView中那样格式化TextView中的文本。

Since I cannot place ListView's within a ScrollView, I need to simulate it by using a TextView . 由于无法将ListView放置在ScrollView中,因此需要使用TextView对其进行仿真。 I need to format the data into columns like I would in a ListView, with data wrapping in the second display field, being a different font based on the rows condition. 我需要像在ListView中一样将数据格式化为列,并在第二个显示字段中包装数据,这是基于行条件的不同字体。

Is there any way to format the data in a TextView to look like data in a ListView such as below: 有什么方法可以格式化TextView中的数据,使其看起来像ListView中的数据,如下所示:

21   This is the data for   NA  
     this item.

1/2  This is the data for   Q  
     the second item.

3    This data should be a  NA  
     different font.

Can anyone tell me how to do this? 谁能告诉我该怎么做?

使用多个TextView ,可能在ScrollView内部的TableLayout中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM