标签:
package com.panjn.userinterface; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.PopupWindow; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); View root = getLayoutInflater().inflate(R.layout.activity_main,null); /** * public PopupWindow (View contentView, int width, int height, boolean focusable) */ final PopupWindow popupWindow = new PopupWindow(root,500,500,true); popupWindow.setBackgroundDrawable(getResources().getDrawable(R.mipmap.ic_launcher)); findViewById(R.id.btn_show_popup_window).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { System.out.println("show pop up window"); popupWindow.showAsDropDown(v); } }); } }
标签:
原文地址:http://www.cnblogs.com/mmyz-sysu-panjn/p/popupwindow.html