package com.it.hei;
import com.example.myviewutils.OnClick;
import com.example.myviewutils.ViewInject;
import com.example.myviewutils.ViewUtils;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
@ViewInject(R.id.tv1)
private TextView tv1;
@ViewInject(R.id.tv2)
private TextView tv2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewUtils.inject(this);
}
@OnClick({R.id.btn1,R.id.btn2})
public void k(View v){
switch (v.getId()) {
case R.id.btn1:
Toast.makeText(this, "btn1:"+tv1.getText(), Toast.LENGTH_SHORT).show();
break;
case R.id.btn2:
Toast.makeText(this, "btn2:"+tv2.getText(), Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
基于注解, 提供view控件的绑定和点击事件.
License
suchen2/ViewUtils
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
基于注解, 提供view控件的绑定和点击事件.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published