请问如何在BottomSheetDialog中使用?
Opened this issue · 1 comments
magical-xu commented
jiangbing0125 commented
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;
}