要解决Android BottomSheetDialogFragment在圆角后面有颜色的问题,可以尝试以下解决方法:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_bottom_sheet, container, false);
// 设置背景为透明
view.setBackgroundColor(Color.TRANSPARENT);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
通过以上方法,可以将BottomSheetDialogFragment的背景设置为透明,避免圆角后的颜色显示问题。