Question: I have a relative layout in which i add a second relative layout which contains 4 buttons. when i do:
`relativeLayout1.addView(relativeLayout2,params)`
i want that the added relative layout with the 4 buttons slides in from right to left.

[![example](https://i.stack.imgur.com/qNHDk.png)](https://i.stack.imgur.com/qNHDk.png)

Is that somehow possible?

xml:

`<translate xmlns:android="http://schemas.android.com/apk/res/android"
 android:duration="500"
 android:fromXDelta="100%"
 android:toXDelta="0%" >
 </translate>`

code:
```

```
public Panel(Context context) {
    super(context);

    this.setBackgroundColor(Color.BLACK);
    this.setId(R.id.panel);

    right_menubar = new RelativeLayout(context);
    right_menubar.setId(R.id.panel_indicators);

    plp_right_menu_bar = new RelativeLayout.LayoutParams(100, 100);

    this.addView(right_menubar, plp_right_menu_bar);

    Animation fadeIn = AnimationUtils.loadAnimation(context, R.animator.anim);
    right_menubar.startAnimation(fadeIn);

}

```

Answer: 
It really depends on you. There is no "right" way to do it. It depends on how you wish to organize your stylesheets. If you have many media query rules for different viewports, then it might make more sense to do it the way you've been doing, because you're right -- it is more efficient to have sections for different media queries. The examples that you've looked at may be doing it differently to make it more easily understood to other people reading it. I think the only important thing is to try to choose a way and stick to it as much as you reasonably can. (At the same time, rules are meant to be broken occasionally.) In the long run, this will help your code be more predictable, and it'll be easier for you to understand and maintain it.
The Second option is the better way to do it.As if there occurs any change in CSS after sometime then you need to find the class for normal CSS as well as Media Queries.

In this case you just need to search for it once only.