简体   繁体   中英

Where can I find the source for Android home screen widget layout?

Today I had my first time with Android 4.2, and I noticed how the home screen automatically repositions widgets as you drag them:

I recently worked on a similar code for our project, and I have to admit its performance is much worse. My algorithm is really stupid, and I'm looking for better alternatives. This is the closest one I've found yet , but I haven't tested it yet.

From my understanding, this is related to bin packing, but bin packing algorithms focus on putting rectangles as close to each other as possible, while Android implementation focuses on making as few changes as possible from the initial configuration , and thus is aesthetically pleasing.

Because Android is open source, I hoped to learn from their code, but I can't find anything related to laying out rectangles in android.appwidget . What is the right place to look at?

我不是100%肯定,但它看起来像CellLayout.java的launcher2是承担一切这一点。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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