Recently i have installed an application from the play store named walnut where i saw a new feature for popup.In the home screen there is a FloatingActionMenu,when clicking on the menu button it will expand with the items on it,on top of that expanded menu there is an option for add account, and on clicking that option a popup will come from the bottom of the screen to a certain height.I likes to know what feature is used for that popup from the bottom of the screen.Is it really a popup or sliding drawer? I want to use exactly the same feature in my android application.If anyone knows about this feature please help me.Below is the screenshot of this popup layout that comes on button click in walnut application.
If you want to add Buttons to the bottom of your android layout XML file you can achieve it using attribute layout_gravity on LinearLayout or TableRow layout. Below your Parent Layout tag add a LinearLayout or TableRow with attribute android:layout_gravity="bottom".
You can set the layout_height="0dp" of your header, footer and ScrollView and define a layout_weight . Just play around with the values until you find out which works best. The resulting heights of header and footer would dynamically change with the screensize.
RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left or center).
you can use dialog with custom layout in it. only thing you have to do is call it from bottom and use style as material dialog sheet like this
final Dialog mBottomSheetDialog = new Dialog(getActivity(), R.style.MaterialDialogSheet);
mBottomSheetDialog.setContentView(view); // your custom view.
mBottomSheetDialog.setCancelable(true);
mBottomSheetDialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
mBottomSheetDialog.getWindow().setGravity(Gravity.BOTTOM);
mBottomSheetDialog.show();
I change my layout height to 800 instead of wrap content and here is the result.
style.xml
<style name="MaterialDialogSheet" parent="@android:style/Theme.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowAnimationStyle">@style/MaterialDialogSheetAnimation</item>
</style>
<style name="MaterialDialogSheetAnimation">
<item name="android:windowEnterAnimation">@anim/popup_show</item>
<item name="android:windowExitAnimation">@anim/popup_hide</item>
</style>
anim
popup_show.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="100%p"
android:toYDelta="0"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"/>
</set>
popup_hide.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="0"
android:toYDelta="100%p"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"/>
</set>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With