问题
Here is my code :
menubuttonClosed = li.inflate(R.layout.menu_button, null);
menubutton = (ImageButton) menubuttonClosed.findViewById(R.id.menubutton);
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,// | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
PixelFormat.TRANSLUCENT);
params.x = 0;
params.y = 0;
params.gravity = Gravity.CENTER;
menubutton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
return true;
case MotionEvent.ACTION_UP:
//Do something here to resize the View
return true;
case MotionEvent.ACTION_MOVE:
return true;
}
return false;
}
});
windowManager.addView(menubuttonClosed, params);
I have a Layout added to the windowmanager, and I want to resize it to fill the screen, Can I do this ?
来源:https://stackoverflow.com/questions/20829800/android-resize-view-in-windowmanager