V
V
Vermut7562017-02-15 18:12:38
Java
Vermut756, 2017-02-15 18:12:38

How on Android to make the ProgressBar appear already in onCreate, in the sense as quickly as possible, regardless of the severity of other elements?

There is an Activity, there is a fragment in it, in this fragment there is a WebView in the entire fragment, as well as a FrameLayout in which the ProgressBar is on top of the WebView.
in TheFragment.OnCreateView the layout is inflated, then the WebView is configured, something else can also happen - work with the database there, then loadUrl is called there, and then the progressbar is hidden in WebViewClient.onPageFinished.
And where is the progressbar shown before all this? That's just the point that it is initially visible.
However, when opening a fragment, it takes about half a second before it appears.
How can you speed up?
Does the fact that the WebView in the tree is located before the ProgressBar affect and this time is spent on its creation?
Do I understand correctly that onCreateView is called before any renderings, if so, is it possible to call the rendering already in it so that the progressbar at least appears (albeit in a hung state).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-02-15
@zagayevskiy

You can inflate in parts - in the usual way, the progressbar with the light part of the hierarchy, separately, using AsyncLayoutInflater - the heavy part. At the same time, you need to make sure that the webview can be asynchronously inflated (see the link for more details).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question