Проблема, с которой я столкнулся при ответе HenrikS, заключалась в том, что в моем случае у меня были некоторые представления за относительной компоновкой, и когда я попытался щелкнуть по ним, я понял, что относительная компоновка перехватывает эти щелчки, потому что ширина была установлена в fill_parent.
Чтобы обойти это, я изменил расположение представления обработчика (ImageView) в моем случае слева, надеюсь, что это полезно.
public class CustomSlidingDrawer extends SlidingDrawer {
public CustomSlidingDrawer(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public CustomSlidingDrawer(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
final int height = b - t;
ImageView handle = (ImageView) getHandle();
int childLeft = 0;
int childWidth = handle.getWidth();
int topOffset = 0;
int bottomOffest = 0;
int childHeight = handle.getHeight();
int childTop = this.isOpened()?topOffset:height - childHeight + bottomOffest;
handle.layout(childLeft, childTop , childLeft + childWidth, childTop+childHeight);
}
}