Android : Transparent Actiobar in android

on Thursday, August 14, 2014


I am trying to give transparent effect to my action bar. I have used the following line to make it work that way, but strangely on my Nexus 5 I am can see the bar coming, but on my galaxy nexus I don't see it at all.


I am not sure why this is coming up on N5? How to solve this issue?


Here is the code:



getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowHomeEnabled(false);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
actionBar.setStackedBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
setContentView(R.layout.profile);


Here is the screenshot for both Galaxy nexus running Jelly Bean (4.3) and Nexus 5 running kitkat (4.4.4)


Galaxy Nexus: showing transparent action bar perfectly:


enter image description here


Nexus 5: showing transparent action bar: (A horizontal line is shown)


enter image description here


0 comments:

Post a Comment