有没有人知道如何正确配置android应用程序,以便将导航组件与新的闪屏API结合使用?我遇到了setContent的问题...
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
splashScreenViewModel = new ViewModelProvider(this).get(SplashScreenViewModel.class);
view = inflater.inflate(R.layout.fragment_splash_screen, container, false);
// Handle the splash screen transition.
SplashScreen splashScreen = SplashScreen.installSplashScreen(getActivity());
setContentView(R.layout.main_activity);
return view;
}发布于 2021-09-23 20:28:17
你不应该仅仅为了显示闪屏而做另一个活动,因为你将需要手动硬编码这个屏幕将持续的时间,这永远不会好,因为启动时间应该尽可能短。通过这样做,你减慢了启动过程,你的应用程序的用户需要等待更多的时间来获取内容,这是你的应用程序中最重要的事情,而不是闪屏。我推荐的是创建一个简单的徽标/视图飞溅,这在这个视频中呈现得相当好。
链接:https://www.youtube.com/watch?v=rIHArmoq9f8&ab_channel=PhilippLackner
https://stackoverflow.com/questions/69306363
复制相似问题