短视频直播源码,DialogFragment全屏且半透明
DialogFragment基本使用:
TestDialogFragment dialogFragment = new TestDialogFragment(); dialogFragment.show(getSupportFragmentManager(), "test");
默认唤起的DialogFragment不全屏,四周有边距。可通过setStyle实现全屏且透明:
<style name="fragment_dialog" parent="@android:style/Theme.NoTitleBar.Fullscreen"> <item name="android:windowCloseOnTouchOutside">true</item> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">true</item> <item name="android:background">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item> </style>
在自定义DialogFragment的onCreate方法中setStyle:
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(STYLE_NO_TITLE, R.style.fragment_dialog); }
以上就是短视频直播源码,DialogFragment全屏且半透明, 更多内容欢迎关注之后的文章