Question

I need simplest way to implement a sliding overlay panel for my app. Here is what I want to do:

I have a grid view of images in my main activity, when user clicks a Image a sliding overlay drops from top of screen to up to half way showing details of Image and partially hiding contents of grid view, I have searched quite bit and found these articles;

but I do not want to use a library for this simple task as it may be a overkill. So can somebody please share some example to implement it using Framelayout or fragment in minimalistic way possible.

Was it helpful?

Solution

Create a RelativeLayout that has a view that's outside of the screen and move it with an ObjectAnimator that sets the view's translateY property.

ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(yourLayout, "TranslationY", 200 );
objectAnimator.start();

This will animate the move of the layout container.

OTHER TIPS

You can use this

https://github.com/jfeinstein10/SlidingMenu

If you are using Actionbar then you can use this code:

setTheme(theme.whatever);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.content);
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.color)); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top