Answer the question
In order to leave comments, you need to log in
How to create such an animation?
private void setWeigtnMemory(float k,int visibility){
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, 0);
float v = context.getResources().getDisplayMetrics().density;
params.weight = k;
params.topMargin = (int) (20*v);
params.leftMargin = (int) (10*v);
params.rightMargin = (int) (10*v);
relativeMemory.setVisibility(visibility);
relativeWeigth.setLayoutParams(params);
}
setWeigtnMemory(1.2f,View.GONE);
setWeigtnMemory(2.4f,View.VISIBLE);
Answer the question
In order to leave comments, you need to log in
If this is a picture, then through PorterDuff.Mode
If it is a container, then through setAlpha
The algorithm is simple, for example, reduce/increase transparency by 25% 4 times. Or 5 times 20%. Or 10 times 10%.
If the picture is in a container, and you need to show a smooth disappearance, then first change the transparency of the picture from 100 to 0, and at the end assign the container View.GONE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question