第一种imageView = new ImageView(this);FrameLayout decorView = (FrameLayout) getWindow().getDecorView();decorView.addView(imageView);FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) imageView.getLayoutParams();layoutParams.width = DubDisplay.dip2px(this, 38);layoutParams.height = DubDisplay.dip2px(this, 38);layoutParams.gravity = Gravity.BOTTOM | Gravity.END;layoutParams.setMargins(0, 0, DubDisplay.dip2px(this, 20), DubDisplay.dip2px(this, 20));imageView.setBackgroundResource(R.drawable.slipping_top);imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { user_cash_listview.post(new Runnable() { @Override public void run() { user_cash_listview.requestFocusFromTouch(); user_cash_listview.setSelection(0); } }); }}); 第二种/*lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE// 设置为无焦点状态 | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, // 没有边界 PixelFormat.TRANSLUCENT);// 半透明效果lp.gravity = Gravity.BOTTOM;lp.windowAnimations = R.style.bus_view;windowManager.updateViewLayout(view, lp);*/
时间: 2024-10-12 18:53:42