I am trying to build similar listView with transparent header like here Attaching a fixed, transparent, header to a ListView? But how can i change header opacity ? I tried in color code use alpha like: "#00bebebe" but that didnt work.
My header background "title_bar_background"
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Top color -->
<item android:bottom="20dip">
<shape android:shape="rectangle">
<solid android:color="#bebebe"
/>
</shape>
</item>
<!-- Bottom color -->
<item android:top="20dip">
<shape android:shape="rectangle">
<solid android:color="#696969" />
</shape>
</item>
</layer-list>
My header layout "custom_title"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
....
android:background="@drawable/title_bar_background"
android:id="@+id/customLayout"
>
And my listView where i include custom_title
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
..... >
<include
layout="@layout/custom_title"
android:layout_height="40dip"
android:layout_width="fill_parent"/>
this work to change opacity
View backgroundImg = findViewById(R.id.mycustomLayout);
Drawable background = backgroundImg.getBackground();
background.setAlpha(40);
But it works only if im not including that layout in other layout. But how could i manage to set opacity when im including that layout in other one ? (Like my xml layout above)