# QBinder **Repository Path**: mirrors_qstumn/QBinder ## Basic Information - **Project Name**: QBinder - **Description**: 简单的注解绑定View和onClick事件 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-10-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # QBinder 简单的注解绑定View和onClick事件,代替findViewById和setOnClickListener,个人Annotation学习产物 ```groovy compile 'q.rorbin:qbinder:1.0.0' ``` ```java public class MainActivity extends AppCompatActivity { @BindView(R.id.textview) TextView textView; @BindView(R.id.imageview) ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); QBinder.bind(this); textView.setText("Hello Annotation!"); imageView.setImageResource(R.mipmap.ic_launcher); } @OnClick({R.id.textview, R.id.imageview}) private void onClick(View v) { switch (v.getId()) { case R.id.textview: Toast.makeText(MainActivity.this, "Click By TextView", Toast.LENGTH_SHORT).show(); break; case R.id.imageview: Toast.makeText(MainActivity.this, "Click By ImageView", Toast.LENGTH_SHORT).show(); break; } } } ``` #### 更新计划 使用注解处理器代替反射优化性能,编写对应的AS插件