0

I have a normal Activity (A) with visible Action Bar which launches another fullscreen activity (B) to display photos. When (B) finishes and activity (A) is displayed back sometimes I can see the following picture:

Action bar and navigation area artifacts

Please note visual distortion of action bar and navigation areas. The above artifacts disappear only when I start interacting with the activity, scrolling it, etc.

Full screen activity code:

protected void onCreate(Bundle savedInstanceState) {
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    super.onCreate(savedInstanceState);

    ActionBar supportActionBar = getSupportActionBar();
    supportActionBar.hide();
}
  1. No hints in AndroidManifest.xml are used.
  2. Support libraries are used (appcompat)
  3. Reproduced on Nexus 4, Android 5.0.1

The only style customization that I have:

 <style name="Theme.MyApp" parent="@style/Theme.AppCompat" tools:ignore="NewApi">
    <!-- Text appearance -->
    <item name="android:textColorLink">@color/linkColor</item>
</style>

Does anybody know any clues why is that ?

ievgen
  • 1,081
  • 11
  • 20

2 Answers2

2

It is a bug on Lollipop Nexus devices. As workaround it would be possible to disable hardware acceleration on manifest activity's declaration: android:hardwareAccelerated="false" (this slows graphic performances).

GPack
  • 2,494
  • 4
  • 19
  • 50
  • Do you have any reference links to this issue ? – ievgen Apr 13 '15 at 14:02
  • my question http://stackoverflow.com/q/27993851/4274296 and this question http://stackoverflow.com/q/27897850/4274296 – GPack Apr 13 '15 at 15:17
  • I had the opposite issue actually. I disabled hardwareAcceleration, and then these issues started. Reading this post I remembered this again, re-enabled hardwareAcceleration and BAM, problems all gone! – Muppet Feb 09 '17 at 07:02
0

I got the same thing with my application. However, the folowing thing seem to fix that up (at list for me):

 @Override
protected void onResume() {
    super.onResume();

    findViewById(R.id.root).setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            findViewById(R.id.root).setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }
    }, 500);
}

As you can see - I'm trying to switch off Hardware acceleration and than switch it on again for my main root view in the layout. I don't actully know why changing view type worked because that's what you can find on HA Thread:

Note: You currently cannot enable hardware acceleration at the view level. View layers have other functions besides disabling hardware acceleration. See View layers for more information about their uses.

Paul Freez
  • 1,059
  • 15
  • 27