-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
能否在SwitchClickListener返回被点击的View #87
Comments
已经在 allprojects {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
} |
好的,谢谢 |
@Jacksgong 使用快照版本这样无效 api 'cn.dreamtobe.kpswitch:library:1.6.2-SNAPSHOT' |
@r17171709 你要先参考上面提到的申明仓库,anyway,我已经发布了1.6.2,你可以直接使用1.6.2了。 |
感谢官方支持该功能,之前项目中采用hook @r17171709 实在不行可以试试我的方案,将需要知道被点击的view @SuppressLint("AppCompatCustomView")
public class PostClickImageView extends ImageView {
private OnPostClickListener onPostClickListener;
public PostClickImageView(Context context) {
super(context);
}
public PostClickImageView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public PostClickImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public PostClickImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public boolean performClick() {
boolean shouldClick = super.performClick();
if (shouldClick && onPostClickListener != null) {
onPostClickListener.performClick(this);
}
return shouldClick;
}
public static interface OnPostClickListener {
void performClick(View v);
}
public void setOnPostClickListener(OnPostClickListener onPostClickListener) {
this.onPostClickListener = onPostClickListener;
}
} |
@Harlber 点击事件的回调没有修复啊,1.6.2的代码中依然是 if (switchClickListener != null && switchToPanel != null) {
switchClickListener.onClickSwitch(v, switchToPanel);
} |
那你可以试试上面我提及的hook |
大佬。1.6.2这个功能是加上了,但是有个bug ,场景如下 |
可以给点击的View设置setOnTouchListener,这个是在onClick之前执行的,如果返回true,还可以屏蔽掉点击事件 |
能否在SwitchClickListener返回被点击的View,多个panel的情况下,需要这个View来做一些判断。还有如何在登录页面记录下来 键盘高度,这样就不需要使用min-panel-height的配置了
The text was updated successfully, but these errors were encountered: