Together with friends I have created an Android app and I have a strange issue connected with the UI.
When switching between fragments sometimes the UI tends to scramble, create a glitch displayed below.
It happens on my Nexus 5 with Dalvik runtime and stock Android and on my friend's Nexus 4 with ART runtime and SlimKat rom. But it is not observable on another Nexus 5 with Dalvik runtime and 4.4.2 (AOSB rom). The weird thing is that it was not happening before I updated to the newest version of the app.
Below is the layout used, where the main_fragment
is the place I put the Fragment
with the use of transaction.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/main_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</RelativeLayout>
I found out that the glitch appears when this line is executed and it does not matter what I put inside the setBackgroundDrawable
method:
activity.getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(getCurrentTheme(activity))));
Does anybody else have this problem? Or maybe someone knows a workaround or how to make it work?
Edit: I need to change the ActionBar color in runtime (changing theme in app settings).