Reputation: 36654
In my Android App I have a view and on it a pop-up is opened at certain conditions.
How can I set it's position to be at the bottom? (anyhow above the other view).
Today's code just deals with Visibility 'gone' or 'hide'.
This is the popUp Xml:
<RelativeLayout
android:id="@+id/alerterLayout"
android:layout_width="248dp"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:background="@drawable/popup_alerter_base"
android:gravity="right"
android:padding="0dp">
<!--
========================================================================
* Title Text
=======================================================================
-->
<LinearLayout
android:id="@+id/alerterTitleLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true"
android:layout_marginTop="12dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="2dp"
android:orientation="horizontal" >
...
Upvotes: 0
Views: 1927
Reputation: 44571
Assuming you are talking about using PopupWindow, you can use showAtLocation(View v, int gravity, int x, int y)
to get it in the desired spot with respect to whichever View
you want.
You can play with the params
to get the exact result you need.
Upvotes: 2
Reputation:
You can take the layout inside the same xml file as in which you have defined your view, on top of which you need to show the pop-up. Then you can try to make the pop-up layout visible and invisible whenever you want to. Keep the initial visibility of Pop-up layout as GONE.
Upvotes: 0