Android编程,这种窗口怎么打实现的?
2个回答
展开全部
popupwindow可以实现先编写图示布局,背景透明(#33000000)
View parent = ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);
public void showSetTest(Context context, View parent) {
final View popView = View.inflate(context, R.layout.popwindow_Test, null);//加载布局
int width = context.getResources().getDisplayMetrics().widthPixels;
int height = context.getResources().getDisplayMetrics().heightPixels;
final PopupWindow popWindow = new PopupWindow(popView, width, height);
popWindow.setFocusable(true);
popWindow.setOutsideTouchable(false);
//初始化控件 popview.findViewByID(ID)
//增加响应
ColorDrawable colorDrawable = new ColorDrawable(0x33000000);
popWindow.setBackgroundDrawable(colorDrawable);
popWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
}
View parent = ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);
public void showSetTest(Context context, View parent) {
final View popView = View.inflate(context, R.layout.popwindow_Test, null);//加载布局
int width = context.getResources().getDisplayMetrics().widthPixels;
int height = context.getResources().getDisplayMetrics().heightPixels;
final PopupWindow popWindow = new PopupWindow(popView, width, height);
popWindow.setFocusable(true);
popWindow.setOutsideTouchable(false);
//初始化控件 popview.findViewByID(ID)
//增加响应
ColorDrawable colorDrawable = new ColorDrawable(0x33000000);
popWindow.setBackgroundDrawable(colorDrawable);
popWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询