采用注释填充Android布局:Michelangelo
                 jopen
                 12年前
            
                    Michelangelo是一个布局填充(Inflating)Android库。它使用注释处理写你不想写的布局代码并简化您的视图组合生成。
  
一个使用示例:
@InflateLayout(R.layout.custom_view)  public class MyCustomView extends FrameLayout {        public MyCustomView(Context context) {          super(context);      }        @AfterInflate      public void updateTextView() {          ((TextView) findViewById(R.id.my_text_view)).setText("hey!");      }  } R.layout.custom_view:
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:id="@+id/my_text_view" android:layout_width="match_parent" android:layout_height="wrap_content"/> </merge>
Inflating that View is pretty straightforward:
MyCustomView view = Michelangelo.build(this, MyCustomView.class);