Jacksgong/JKeyboardPanelSwitch

请问如何在BottomSheetDialog中使用?

Opened this issue · 1 comments

KPSwitchRootLinearLayout 作为根布局节点,直接就挂掉了
看了下是因为强转报错了
_20180329020800
dialog里这个context不是activity

final Activity activity = (Activity) panelLayout.getContext();

替换下这个试试
/**
* try get host activity from view.
* views hosted on floating window like dialog and toast will sure return null.
* @return host activity; or null if not available
*/
public static Activity getActivityFromView(View view) {
Context context = view.getContext();
while (context instanceof ContextWrapper) {
if (context instanceof Activity) {
return (Activity) context;
}
context = ((ContextWrapper) context).getBaseContext();
}
return null;
}