You can implement this as an overlay on top of the current layout. It can vary from implementation to implementation.
I implemented this using the following approach:
<RelativeLayout> <- This is the parent <RelativeLayout id="actual_layout"> <- This is where you will implement the layout <!--Implement your layout here--> </RelativeLayout> <RelativeLayout id="rating_container" visibility="gone" background="#BB000000"> <- This is to set the translucent black background <RelativeLayout id="rating_dialog" alignParnetTop="true"> <- This is the rating dialog <!--Your implementation here--> </RelativeLayout> </RelativeLayout> </RelativeLayout>
Now switch the visibility of "rating_container" to onCLick of your "Rating" button.
ratingButton.setOnCLickListener(new view.OnCLickListener(){ @Override public void onCLick(View v){ toggleRatingContainer(true); } });
You can follow this approach to fulfill your requirement. Let me know if you need more help.
NOTE. I have not written the full code. In addition, I did not check, but directly typed everything.
EDIT
You can implement toggleRatingContainer as follows:
public void toggleRatingContainer(boolean showRatingDialog){ ratingContainer.setVisibility((showRatingDialog)?View.VISIBLE:View.GONE); }
Here, "ratingContainer" is a "RelativeLayout" with the identifier "rating_container", which you can get in your onCreate function.
And then you can switch its visibility to “View.GONE” when the “Send” or “Cancel” button is pressed, calling the same method that passes “false” as an argument.
source share