我正在使用
com.sothree.slidinguppanel
它的工作正常,但点击监听器不起作用下面是我的代码
slidingLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
slidingLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//my code
}
}
});
所以它永远不会进入我的代码部分,我的意思是它没有点击点击监听器。请帮忙
答案 0 :(得分:1)
因为它已在图书馆中处理:
/**
* Set the draggable view portion. Use to null, to allow the whole panel to
* be draggable
*
* @param dragView
* A view that will be used to drag the panel.
*/
public void setDragView(View dragView) {
if (mDragView != null) {
mDragView.setOnClickListener(null);
}
mDragView = dragView;
if (mDragView != null) {
mDragView.setClickable(true);
mDragView.setFocusable(false);
mDragView.setFocusableInTouchMode(false);
mDragView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!isEnabled() || !isTouchEnabled())
return;
if (mSlideState != PanelState.EXPANDED && mSlideState != PanelState.ANCHORED) {
if (mAnchorPoint < 1.0f) {
setPanelState(PanelState.ANCHORED);
} else {
setPanelState(PanelState.EXPANDED);
}
} else {
setPanelState(PanelState.COLLAPSED);
}
}
});
;
}
}