简体   繁体   中英

How to obtain the below effect in the given activity

How to obtain the below result.

The background i have an activity but hw can i get the popup view as shown below.

or should i inflate an view and right the whole code there

愿望结果

Hi i have an activity.. on a button click i need to popup a view as below, which will work independently as seperate flow... how can i achieve it.. if possible can i have a sample to get the 1st popup screen so tat i can handle other views.

How can this be achieved, if its fragment hw can i achieve it.

You have to create dialog using AlertDialog.Builder and then inflate the View you are showing in the popupwindow and then set the custom view of AlertDialog.Builder as AlertDialog.Builder builder = new AlertDialog.Builder(this) builder.setView()

Hope this helps.

您可以创建一个对话框片段并在此处显示,这是android开发人员指南的链接

I have three method to provide to achieve this effect,but I won't give you sample code,I think try by yourself you can learn more and this is why SOF exists,

  1. use Dialog ,it will be the easiest,you can create your xml layout and use setView() for this dialog,and when you want to show it,use dialog.show() and dialog.dismiss() to dismiss it.
  2. use Fragment to show as the floating view, DialogFragment will be best.
  3. use PopupWindow to show this view,with it,you can create the xml layout and set it to the popupwindow,then you can show it whenever you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM