<pre name="code" class="java">/**
* 批量注册OnFocusChangeListener事件
* @param OnFocusChangeListener
* @param view
*/
public void setOnFocusChangeListener(OnFocusChangeListener o,View... view){
try {
int size=0;
if(null!=view&&(size=view.length)>0){
for(int i=0;i<size;i++){
try {
if (null != view[i])
view[i].setOnFocusChangeListener(o);
} catch (Exception e) {
continue;
}
}
}
} catch (Exception e) {
return;
}
}
/**
* 批量注册OnClickListener事件
* @param onClickListener
* @param view
*/
public void setOnClick(OnClickListener o,View... view){
try {
int size=0;
if(null!=view&&(size=view.length)>0){
for(int i=0;i<size;i++){
try {
if (null != view[i])
view[i].setOnClickListener(o);
} catch (Exception e) {
continue;
}
}
}
} catch (Exception e) {
return;
}
}
/**
* 批量注册setFocusable事件
* @param Boolean
* @param view
*/
public void setFocusable(Boolean f,View... view){
try {
int size=0;
if(null!=view&&(size=view.length)>0){
for(int i=0;i<size;i++){
try {
if (null != view[i])
view[i].setFocusable(f);
} catch (Exception e) {
continue;
}
}
}
} catch (Exception e) {
return;
}
}
/**
* 批量注册setChecked事件
* @param Boolean
* @param CheckBox
*/
public void setChecked(Boolean f,CheckBox... checkBox){
try {
int size=0;
if(null!=checkBox&&(size=checkBox.length)>0){
for(int i=0;i<size;i++){
try {
if (null != checkBox[i])
checkBox[i].setChecked(f);
} catch (Exception e) {
continue;
}
}
}
} catch (Exception e) {
return;
}
}
批量注册事件工具类
最新推荐文章于 2021-07-19 16:12:51 发布