Create UI like Chrome for Android

梦想的初衷 提交于 2019-11-29 21:27:57

systemUI/Recents package, as mentioned by Andrei, can be your starting point. It adds a little more to the flat rendition of chrome tabs.

I have been meaning to refactor systemUI/Recents package ever since I got the L update. I finally got to it.

A sample project is hosted at: Link

Even though the viewgroup recycles, it updates the progress map (child properties) for all children on each scroll step. This will lead to lags with large data sets. For a few hundred, it should be fine.

The sample project uses Picasso for loading and caching images from LoremPixel. Since these are random images & may repeat, you can verify that they are bound correctly by looking at bottom left of the image.

Andrei Tudor Diaconu

If you feel like looking through the AOSP code, the functionality you are looking for is actually open-source and you can find it in Android 5.0 in the recent apps screen. This is the code you want to look at on github. The view you want to extract from AOSP is the RecentsView. This would be the best approach.

You could also consider extending StackView and overriding onLayout() so you get the children to lineup.

One other option is to extend ListView, override drawChild or layout methots and try to shift the views according to their position. You can find some inspiration here and here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!