in my layout XML file:
<LinearLayout
...
animateLayoutChanges="true"
... />
When I add and a View
and to this layout and delete it, I can see both fade in and fade out effect. However, I need only the fade in effect. Could anyone tell me what I should do?
You should remove animateLayoutChanges
from layout XML file.
Instead, create a LayoutTransition
object at runtime and supply it to the layout with the setLayoutTransition() method.
private ViewGroup mContainerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_linear_layout);
mContainerView = (ViewGroup) findViewById(R.id.container);
LayoutTransition lt = new LayoutTransition();
lt.disableTransitionType(LayoutTransition.DISAPPEARING);
mContainerView.setLayoutTransition(lt);
}