Why does installing hardware with a lie make things faster?

I have an application that works on tablet devices with two panels, for the left - a simple animation when replacing a fragment:

private void loadLeftFragment(Fragment fragment, boolean isAnimated) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); if (isAnimated) { fragmentTransaction.setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right); } fragmentTransaction.addToBackStack(null); fragmentTransaction.replace(R.id.left_frame, fragment).commit(); } 

Pay attention to the animation of the code world. It works great on the Nexus 7, but on the Galaxy Tab 2 it is not. Therefore, I experimented with the android:hardwareAccelerated="true/false" tag android:hardwareAccelerated="true/false" in AndroidManifest.xml. And what I got is that when the value is set to false , the animation on the Galaxy Tab 2 is, for example, on the Nexus 7, that is, smooth and good looking. I did not expect this behavior, believing that it should be the other way around - setting hardwareAccelerated to true makes things smoother. But this will happen if I set it to true I see lags when false is just nice! What am I missing here? Thanks.

+6
source share
1 answer

Well, it all depends on memory usage. What happens when you turn on hardware acceleration, application animations, and user interface rendering happen with the GPU, which causes the system to use the hit for in-memory use. Downloading OpenGL drivers for each process requires approximately 2 MB of memory and increases it to 8 MB. On devices with limited RAM, this can be a real problem. When more memory is eaten, the system will need to close more background tasks to save memory.

Therefore, this option should be used intelligently and depending on the target devices.

+7
source

Source: https://habr.com/ru/post/949631/


All Articles