Android APIDemo学习之Listview(首字母提示悬浮框)

其实首字母提示框本质上来说是一个View,View悬浮与界面之上。设置首字母悬浮提示框,有以下几点要点:

1、获得WindowsManger服务

WindowManager mWindowsManger =(WindowManager)getSystemService(Context.WINDOW_SERVICE); TextView mShowText=(TextView) LayoutInflater.from(this).inflate(R.layout.popup_char_hint, null); mShowText.setText("测试"); WindowManager.LayoutParams lp = new WindowManager.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); mWindowsManger.addView(mShowText, lp);

你可能感兴趣的:(Android APIDemo学习之Listview(首字母提示悬浮框))