一些细节(小知识)

1、@ViewInject

  和findViewById()方法一样,简便的写法,谷歌官方并不推介。

  

 @ViewInject(R.id.ll_top_view)
  private View mTopView;

  和

  

1 private View mTopView;
2 mTopView=this.findViewById(R.id.ll_top_view);

  一样。

2、有关layout_weight

  使用layout_weight有时候不会起到作用,原因就是使用layout_weight的时候要将layout_width设置为match_parent:

  

android:layout_width="match_parent"
原文地址:https://www.cnblogs.com/YaoJianXun/p/5462579.html