public void setDrawerLeftEdgeSize( DrawerLayout drawerLayout, float displayWidthPercentage) {
try {
// find ViewDragHelper and set it accessible
Field leftDraggerField = drawerLayout.getClass().getDeclaredField(
"mLeftDragger");
leftDraggerField.setAccessible(true);
ViewDragHelper leftDragger = (ViewDragHelper) leftDraggerField
.get(drawerLayout);
// find edgesize and set is accessible
Field edgeSizeField = leftDragger.getClass().getDeclaredField(
"mEdgeSize");
edgeSizeField.setAccessible(true);
int edgeSize = edgeSizeField.getInt(leftDragger);
// set new edgesize
Point displaySize = new Point();
getActivity().getWindowManager().getDefaultDisplay()
.getSize(displaySize);
edgeSizeField.setInt(leftDragger,
(int) (displaySize.x * displayWidthPercentage));
} catch (NoSuchFieldException e) {
// ignore
} catch (IllegalArgumentException e) {
// ignore
} catch (IllegalAccessException e) {
// ignore
}
}
단, 위 소스를 사용할시, 드래그 허용 퍼센트(화면의 X크기)가 DrawerView(드래그해서 튀어나오는 메뉴)의 Width보다 크다면, LongClick과, 드래그에 오묘한 현상이 일어나게 된다. 즉 slideoffest이 1.0f 이상이 나올 수 있다는 점이다. 이 점 생각해 적당하게 설정하기 바람