1
Good morning!
I’m having trouble finding some property of Linearlayout to control transparency.
My situation is as follows I have a Linearlayout with a background image, and I also have Homescrollviewobserver for all XML in the onScrollChanged method from Homescrollviewobserver need to apply a transparency effect or smooth the background image change.
Below is an excerpt of the code, this code is only changing the background image.
<LinearLayout
android:id="@+id/ll_icons_path"
android:layout_width="fill_parent"
android:layout_height="900dp"
android:background="@drawable/home_icons_path"
android:orientation="vertical">
//Método que controla a rolagem da tela na vertical(y) e horizontal(x)
@Override
public void onScrollChanged(HomeScrollViewObserver scrollView, int x, int y, int oldx, int oldy) {
//Coloca a imagem de fundo padrão (fundo branco) somente é alterado quando o valor y for menor ou igual a 5
if (y <= 100) {
ll_icons_path.setBackgroundResource(R.drawable.home_icons_path);
} else {
//Verifica se o valor de y é maior ou igual a 6 e muda imagem de fundo(fundo transparente)
if (y >= 101){
ll_icons_path.setBackgroundResource(R.drawable.home_icons_path_semfundo);
}
}
}
Maybe I don’t understand your question but you can control the transparency of a Imageview through
setAlpha()
(setImageAlpha() API16+).– ramaral
When the
y
is equal to 100 want the images to have 50% transparency each?– ramaral