Position Afollestad Materialdialog Below A Button
Is there an option to position https://github.com/afollestad/material-dialogs below a button as like the mock up I have attached . Or is there any other library to fulfill my requ
Solution 1:
You need to catch the location of the clicked UI that is your Filter iconImageView
. You have to use the
getLocationOnScreen() API and PopUpWindow component.
This is the sample code for inflating the FilterUI
text_click=(TextView)findViewById(R.id.text_click);
text_click.setOnClickListener(newView.OnClickListener() {
@OverridepublicvoidonClick(View v) {
LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int[] locationOfView = newint[2];
text_click.getLocationOnScreen(locationOfView);
finalViewmView= inflater.inflate(R.layout.activity_map_view, null, false);
finalPopupWindowpopUp=newPopupWindow(mView, 500, 500, false);
popUp.setTouchable(true);
popUp.setFocusable(true);
popUp.setOutsideTouchable(true);
popUp.setBackgroundDrawable(newColorDrawable(ContextCompat.getColor(mContext,android.R.color.transparent)));
popUp.showAtLocation(mView, Gravity.NO_GRAVITY, locationOfView[0], (locationOfView[1]+ text_click.getHeight()));
}
});
Post a Comment for "Position Afollestad Materialdialog Below A Button"