原文:http://blog.csdn.net/ws10052797/article/details/52924876
Method
1 用”android:drawableLeft“取代”android:background”来设置CheckBox的自定义样式;同时自身设置”android:text”来显示文字提示,取代CheckBox+TextView的模式.
具体代码见原文
2 使用TouchDelegate, 引用自 link text.
I asked a friend at Google and they were able to help me figure out how to use TouchDelegate. Here’s what we came up with:
final View parent = (View) delegate.getParent();
parent.post( new Runnable() {
// Post in the parent's message queue to make sure the parent
// lays out its children before we call getHitRect()
public void run() {
final Rect r = new Rect();
delegate.getHitRect(r);
r.top -= 4;
r.bottom += 4;
parent.setTouchDelegate( new TouchDelegate( r , delegate));
}
});
亲测可用.
附上近期一篇火热的解析: