I want move a focus form a view of the WindowManager
to the other views to quit the application.
But I don't want to use FLAG_NOT_FOCUSABLE
. Is there any other way to solve this?
for example,
public class WindowManagerTest extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.windowmanagertest);
WindowManager wm = (WindowManager)getSystemService(
Context.WINDOW_SERVICE);
Display dis = wm.getDefaultDisplay();
TextView result = (TextView)findViewById(R.id.result);
Point pt = new Point();
dis.getSize(pt);
result.setText("width = " + pt.x + "\nheight = " + pt.y +
"\nrotate = " + dis.getRotation());
ImageView img = new ImageView(this);
img.setImageResource(R.drawable.clover);
WindowManager.LayoutParams param = new WindowManager.LayoutParams();
param.gravity=Gravity.LEFT | Gravity.TOP;
param.x = 100;
param.y = 20;
param.width = WindowManager.LayoutParams.WRAP_CONTENT;
param.height = WindowManager.LayoutParams.WRAP_CONTENT;
//param.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
param.format = PixelFormat.TRANSLUCENT;
wm.addView(img, param);
}
}
sounds like you're looking for the following:
img.setFocusable(true);
img.setFocusableInTouchMode(true);
or set those to false on the window manager?