
Android Popup Örneği
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
public void showPopup(View view) { //popup ekranı için 1 adet layout oluşturduk final View popupView = getLayoutInflater().inflate(R.layout.custom_popup_stock_detail, null); final PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); TextView tvStockName = (TextView) popupView.findViewById(R.id.tvStockName); ImageButton ibNegative=(ImageButton)popupView.findViewById(R.id.ibNegative); tvStockName.setText(stockName); ibNegative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { popupWindow.dismiss(); } }); //popup konum ayarlaması popupWindow.setFocusable(true); popupWindow.setBackgroundDrawable(new ColorDrawable()); int location[] = new int[2]; view.getLocationOnScreen(location); popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); } |