3

A window that is shows on screen

public class FlatingViewService extends Service{
      public static WindowManager windowManager;
              ...

    windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
     ...

    //Floating View Layout
   li = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);

   myView = li.inflate(R.layout.product_response_card, null);

  name =  (TextView) myView.findViewById(R.id.name);

  editTextName = (TextView) myView.findViewById(R.id.editTextName);
    ...

    //Layout Parameters
    ...
   response_card_params.softInputMode =  WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE;

When user tries to enter some text into editText, Keyboard appears but on top of editText. So the user can't see anything.

What's the actual problem?

Cœur
  • 37,241
  • 25
  • 195
  • 267
KDroid
  • 81
  • 1
  • 5

2 Answers2

5

Got the problem solved.

//Layout Parameters for Product response card
        layout_params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.MATCH_PARENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_PHONE,
                WindowManager.LayoutParams.FLAG_DIM_BEHIND,
                PixelFormat.TRANSLUCENT);
        layout_params.gravity = Gravity.LEFT;
        layout_params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;

I was using WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, instead of WindowManager.LayoutParams.TYPE_PHONE

And WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN

KDroid
  • 81
  • 1
  • 5
2

Starting from API 19 options SOFT_INPUT_ADJUST_PAN and SOFT_INPUT_ADJUST_RESIZE don't affect windows with types TYPE_SYSTEM_ALERT and TYPE_TOAST (and TYPE_VOLUME_OVERLAY for API 21 and 22; in API 23 TYPE_VOLUME_OVERLAY removed from this list).

Instead of use TYPE_SYSTEM_ALERT need use TYPE_PHONE.

Enyby
  • 4,162
  • 2
  • 33
  • 42