1. 使用ConstraintLayout减少嵌套,使用inclue,merge,viewstub等
2. 使用异步加载布局,AsyncLayoutInfater。
//子线程异步执行xml加载
new AsyncLayoutInflater().inflate(R.layout.activity_main.xml,null,new AsyncLayoutInflater.onInflateFinished(){
@override
public void onInFlateFinished(View view,int resid,ViewGroup parent){
setContentView(view)
}
})
文章介绍了如何通过使用ConstraintLayout来减少布局嵌套,以及利用include,merge,viewstub等方法提高效率。同时,提出了使用AsyncLayoutInflater进行子线程异步加载布局以提升应用性能,避免UI阻塞。
1817

被折叠的 条评论
为什么被折叠?



