Set custom layout in popup window in android

前端 未结 6 1838
别那么骄傲
别那么骄傲 2020-12-05 23:42

I have a problem with popup window. I want to create popup window with my own layout. This is code:

public class PopupWindowView extends PopupWindow{

    P         


        
6条回答
  •  失恋的感觉
    2020-12-06 00:43

    You can use LayoutInflater

    LayoutInflater inflater = (LayoutInflater) act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.custom_layout, null); //custom_layout is your xml file which contains popuplayout
    LinearLayout layout = (LinearLayout) view.findViewById(R.id.popuplayout);
    

提交回复
热议问题