gpt4 book ai didi

android - 滑动面板 onclicklistner 不工作

转载 作者:行者123 更新时间:2023-11-30 00:46:12 25 4
gpt4 key购买 nike

我正在使用

com.sothree.slidinguppanel

它工作正常但是点击监听器不工作下面是我的代码

slidingLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
slidingLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//my code
}
}
});

所以它永远不会进入我的代码部分,我的意思是它没有点击点击监听器。请帮忙

最佳答案

因为它已经在库中处理了:

    /**
* 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);
}
}
});
;
}
}

关于android - 滑动面板 onclicklistner 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41764010/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com