![]() ![]() This trick works very well, but only when your views are similar to each other. ![]() Android’s simple tool to solve this is view recycling: The adapter’s getView method will get an existing convertView to use if one was made before. It becomes challenging when trying to render rich content which contains complicated views - a lot of text and images, for example. This is easily achievable for simple content, such as the views that contain text only. (In fact, since other actions have to happen, such as measuring and drawing, there’s even less time). That method, in turn, has to get a view, and bind all its content into it in less than 16.7ms. Whenever a new view goes into the viewport in your ListView, the ListView will call its adapter’s getView method. ![]() This is pretty easily done for most frames with the exception of a notable subset. Basic arithmetic translates this challenge into rendering one frame in under 16.7 milliseconds. To get your list to appear as if it scrolls smoothly, you need to render about 60 frames of it per second. This need wasn’t as important when using a keyboard and mouse. Users expect that the content will seamlessly keep pace with their fingers as they scroll on a touchscreen. ListView presents an interesting performance problem that wasn’t as dominant on non-touch interfaces – the smoothness of the scrolling experience. Keeping News Feed working well in Facebook’s Android app presents a variety of engineering challenges starting with performance considerations for touchscreens. In the case of Facebook for Android, this ListView is your News Feed. In many cases, it may be the screen of your app where users interact with the app the most. If you work on an Android app (or any touch screen based app actually), there’s a very good chance you have at least one activity based on a ListView. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |