TextView中使用HTML表格VS TableLayout有一些TextViews [英] TextView with html Table vs TableLayout with a few TextViews

查看:251
本文介绍了TextView中使用HTML表格VS TableLayout有一些TextViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在在Android应用程序,我最近碰到里面提到一个活动的目标应该是小于80的看法发生什么事了。

I'm currently working on an android application and I recently came across something which mentioned that an activity should aim to have less than 80 views.

我在每一个部分textviews一对夫妇tablelayouts。难道是更有效率/可能有一个TextView的,并使用HTML表格,试图达到相同的外观我与tablelayouts?

I have a couple tablelayouts with some textviews in each one. Would it be more efficient/possible to have one textview and use html tables to try and achieve the same look I have with the tablelayouts?

这将减少的若干意见,但它是值得返工布局的时候?

It would cut down on the number of views, but would it be worth the time to rework the layout?

推荐答案

要获得 Spannable -object(可显示在的TextView )形成一个HTML剪断,您可以使用 HTML 从Android框架,如左图所示:的如何在TextView中显示HTML?

To get a Spannable-object (which can be displayed in a TextView) form an HTML snipped, you can use the HTML-class from the Android framework, as illustrated here: How to display HTML in TextView?

不过,对于这一类的文档还指出:

However, the docs for this class also state that:

本类处理HTML字符串转换为可显示的样式文本。 不会
  所有的HTML标签都支持。

This class processes HTML strings into displayable styled text. Not all HTML tags are supported.

支持的一个很好的列表的标签可以在这个答案发现此<一个HREF =htt​​p://commonsware.com/blog/An​​droid/2010/05/26/html-tags-supported-by-textview.html相对=nofollow>博客帖子(剧透:&LT;表&gt; 不会支持)

A nice list of supported tags can be found in this answer and this Blog-Post (Spoiler: <table> is not supported).

从理论上说,其在一个活动80余意见很多。在初步实践,事实证明,这可以通过许多手机轻松处理。

Theoretically, having more than 80 views on one Activity is a lot. In pratice, it turns out that this can be handled by many phones with ease.

我创建的收集地理数据,并以表(这将有超过900项)中显示的所有拍摄地点的应用程序。即使自如滚动(在我的摩托罗拉Xoom和我的HTC Desire HD)。

I created an application that collected Geo-Data and displayed all taken locations in a table (which would have more than 900 items). Even with the full table it scrolls smoothly (on my Motorola Xoom and my HTC Desire HD).

如果您遇到与特定设备上的长列表/表中的任何问题,总是有选择的延迟加载

If you should encounter any problems with long lists/tables on certain devices, there is always the option of lazy loading.

它应该是在顶部显示的最重要的/ precise数据(因此用户不需要在所有滚动)。

It should be a general goal to show the most important/precise data at the top (so the user does not need to scroll at all).

所以,你会表现出可以说30最好的安打,当用户向下滚动到20号(左右),你异步加载在接下来的30项。这样一来,你会得到一个永无止境的名单(因为数据是无穷的)。

So, you would show the lets say 30 best hits and when the user has scrolled down to number 20 (or so), you asynchronously load the next 30 entries. That way, you get a never ending list (given that the data is endless).

这篇关于TextView中使用HTML表格VS TableLayout有一些TextViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆