Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Implement Contact details screen like Lollipop

I want to implement Contact details screen like Android 5.0 aka Lollipop.

To describe more when we click on icon/image of any contact, one view slide up from bottom of screen. By default, this view fills half of screen and remaining top of screen is transparent with little alpha added.

Secondly, View changes its position upward with finger swipe in upward direction, also transparent part become more darker and at one position name of contact (TextView) start reducing its font size. This continues till it become part ActionBar.

I have some queries regarding how to implement this

  1. Is Contact details View a separate activity with transparent half at the top or it is overlay for contact list screen only

  2. What is best possible solution to show animation with gesture (changing position with finger swipe).

  3. How to reduce size of keyboard with finger swipe and how to determine that now TextView should start reducing its font size

  4. Last one is How to make TextView as part of actionbar with finger swipe changes

like image 315
silwar Avatar asked Apr 21 '15 14:04

silwar


1 Answers

Use android.support.design.widget.BottomSheetDialog

For example:

BottomSheetDialog mBottomSheetDialog = new BottomSheetDialog(this);
View view = getLayoutInflater().inflate(R.layout.your_layout, null);
// do any view specific operations here like adding click listener etc..,
mBottomSheetDialog.setContentView(view);
mBottomSheetDialog.show();

And when you have any scrollable widgets(Nested Scrollview or RecyclerView) in your layout inflated, it will work very smooth.

The interesting part is you can set the initial content height

BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) view.getParent());
mBehavior.setPeekHeight(dialog height);
like image 109
Muhammad Riyaz Avatar answered Oct 19 '22 10:10

Muhammad Riyaz