【发布时间】:2020-09-17 20:35:18
【问题描述】:
我正在尝试使我的 BottomSheetDialog 的顶角变圆,但我在网上没有任何运气。这就是我想要的样子:
无论我尝试了什么,我都会得到这个:
我已经尝试了here 的方法并使用了 shapeAppearanceLargeComponent(我现在正在使用的)。
这是我的代码:
styles.xml
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
...
<item name="shapeAppearanceLargeComponent">@style/CustomShapeAppearanceBottomSheetDialog</item>
</style>
<style name="CustomShapeAppearanceBottomSheetDialog" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">16dp</item>
<item name="cornerSizeTopLeft">16dp</item>
</style>
底部导航菜单片段:
public class BottomNavMenuFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_bottom_nav_drawer, container, false);
}
}
这就是我展示片段的方式:
BottomNavMenuFragment navFragment = new BottomNavMenuFragment();
navFragment.show(getSupportFragmentManager(), navFragment.getTag());
我似乎没有做任何事情。有人能指出我正确的方向吗?
【问题讨论】:
-
我有,但还是不行。
-
你上面贴的代码不一样
-
我知道,我试过了,但没有任何区别。
-
这能回答你的问题吗? Round corner for BottomSheetDialogFragment
标签: java android material-design android-bottomsheetdialog