Created
May 18, 2015 08:21
-
-
Save billyriantono/7cf05eee1a975e0e7315 to your computer and use it in GitHub Desktop.
Change ActionToolbar Android to be transparent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<solid android:color="@android:color/transparent" /> | |
</shape> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void transparentBackgroundToolbarsIcon(Toolbar toolbarView) { | |
for (int i = 0; i < toolbarView.getChildCount(); i++) { | |
final View v = toolbarView.getChildAt(i); | |
if (v != null && v instanceof TextView) { | |
TextView t = (TextView) v; | |
t.setBackgroundResource(R.drawable.background_transparent); | |
} | |
if (v instanceof ActionMenuView) { | |
v.setBackgroundResource(R.drawable.background_transparent); | |
} | |
} | |
toolbarView.setBackgroundResource(R.drawable.background_transparent); | |
toolbarView.invalidate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment