</pre><pre name="code" class="java">private void enlargePwdClickArea(View view) {
View parent = (View) view.getParent();
parent.post(new Runnable() {
public void run() {
Rect outRect = new Rect();
view.getHitRect(outRect);
int tempSize = getResources().getDimensionPixelSize(R.dimen
.size_large_click);;
outRect.left -= tempSize;
outRect.top -= tempSize;
outRect.right += tempSize;
outRect.bottom += tempSize;
TouchDelegate deldgate = new TouchDelegate(outRect, view);
if (View.class.isInstance(parent)) {
((View) parent).setTouchDelegate(deldgate);
}
}
});
}
扩大控件的点击区域
最新推荐文章于 2023-12-10 20:18:10 发布