Unable to click EditText after adding to WindowManager

I create the layout quite dynamically. I do this by creating an EditText, adding it to the RelativeLayout object, and putting it into the user interface through WindowManager. How can I get edittext after input? Here is my code of my code

RelativeLayout layout = new RelativeLayout(this); private EditText response = new EditText(this); **Set width/height/extra** layout.addView(response, params); //Params are set properly WindowManager myWindow = (WindowManager) getSystemService(WINDOW_SERVICE); myWindow.addView(layout, params_window); 

EDIT: I'm trying to create a popup message, for example, in a LilyPad application (I'm not sure if you know about this). I am trying to change the text dynamically. Here is what I did:

  LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); myView = layoutInflater.inflate(R.layout.popups, null ); message = (TextView)myView.findViewById(R.id.message); message.setText(text); 

Then after that I follow the @android developer method. But I get a null pointer exception in the message.setText (text) part. The message is initialized as a TextView object, and I checked that there is a TextView identification message in the popups.xml file. THIS IS FIXED I did not start windowManager. Sorry, ignore this, please see My problem in Edit III

EDIT II: Here is another picture of what I want. http://imgur.com/yXJ36n1 The gray rectangles are in the RelativeLayout in the XML file. Ex. if I am on my facebook wall, I want the facebook wall to appear on the black area at the top and want it to scroll in the facebook wall without application intervention (for example, in LilyPad). If i do

  LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); myView = layoutInflater.inflate(R.layout.popups, null ); 

then configure WindowManager using the Transparent we checkboxes and add my view, the background screen is not working. The background does not stop, but I do not like to scroll through the windows, for example. The problem is that RelativeLayout is full screen. These are my RelativeLayout properties defined in the xml file

 android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" 

EDIT IV: https://lh4.ggpht.com/gnNfCsUU7cTCTedhny-wej-nbGmL1fktcw5qo92CCOLQ9ySG5t4pCRKYSt7u--kjpw=h900-rw Here is the LilyPad camera

+4
source share
1 answer

here, how do you put the view on top of everything:

 final WindowManager.LayoutParams param=new WindowManager.LayoutParams(); param.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; final View view=... final ViewGroup parent=(ViewGroup)view.getParent(); if(parent!=null) parent.removeView(view); param.format=PixelFormat.RGBA_8888; param.type=WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; param.gravity=Gravity.TOP|Gravity.LEFT; param.width=view.getLayoutParams().width; param.height=view.getLayoutParams().height; final WindowManager wmgr=(WindowManager)getApplicationContext().getSystemService(Context.WINDOW_SERVICE); wmgr.addView(view,param); // TODO handle overlapping title bar and/or action bar // TODO you must add logic to remove the view // TODO you must use a special permission to use this method :android.permission.SYSTEM_ALERT_WINDOW 

you can put a view inside XML if you want to easily see how it should look. The code I wrote will separate it from your layout and put it in the window itself.

-one
source

Source: https://habr.com/ru/post/1494741/


All Articles