针对这个问题,在网上搜索了下,有以下一些看法:
1、fragments are more reusable than custom views.
作者认为,fragment能够封装单靠view无法处理的事。自定义控件无法处理跨activity交互等事件,还是需要靠activity来完成,这会增加custom views 和activity的耦合。不利于复用。而fragment可以封装更多的东西,包括AsyncTask,file and database access等。
2、the main reason to use Fragments are for the backstack and lifecycle
features. Otherwise, custom views are more light weight, simpler to
implement, and have the advantage that they can be nested.
see here
主要原因是fragment提供了backstack支持界面状态的回退,以及生命周期特性。(在SDK 17 以后fragment也支持嵌套了)