0

I am not able to see editText control when I typing in because soft keyboard covers up(hide) editText control code sample is as below :

private LinearLayout.LayoutParams LY_Scroll = new LinearLayout.LayoutParams(
            LayoutParams.FILL_PARENT, 388);
    private LinearLayout.LayoutParams LY_BOTTOM = new LinearLayout.LayoutParams(
            LayoutParams.FILL_PARENT, 45);
    private LinearLayout.LayoutParams LY_EDIT = new LinearLayout.LayoutParams(
            267, LayoutParams.FILL_PARENT);
    private LinearLayout.LayoutParams LY_BTN = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
    private LinearLayout.LayoutParams LY_TEXT = new LinearLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);


@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        LinearLayout layout_all = new LinearLayout(this);
        layout_all.setOrientation(LinearLayout.VERTICAL);
        layout_all.setBackgroundColor(android.graphics.Color.WHITE);

        // top
        setContentView(layout_all);

        sv = new ScrollView(this);
        sv.setLayoutParams(LY_Scroll);

        text_Show = new TextView(this);
        text_Show.setLayoutParams(LY_TEXT);
        sv.addView(text_Show);

        // bottom
        LinearLayout layout_bottom = new LinearLayout(this);
        layout_bottom.setLayoutParams(LY_BOTTOM);
        layout_bottom.setOrientation(LinearLayout.HORIZONTAL);

        editText = new EditText(this);
        editText.setLayoutParams(LY_EDIT);

        sendBtn = new Button(this);
        sendBtn.setLayoutParams(LY_BTN);
        sendBtn.setText("Send");

        layout_bottom.addView(editText);
        layout_bottom.addView(sendBtn);

        layout_all.addView(sv);
        layout_all.addView(layout_bottom);

        ........
    }

Can any one have idea how to make editText visible when I type in soft keyboard ?

Thanks In Advance,

Muthu Kumaran
  • 17,682
  • 5
  • 47
  • 70
MohammedYakub M.
  • 2,893
  • 5
  • 31
  • 42

2 Answers2

0

It would appear that the best way is to use windowSoftInputMode to control how your dialog should work. Perhaps you want the adjustPan option, although the docs recommend not using it. See this earlier answer.

Community
  • 1
  • 1
Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
0

Add this in your manifest under the activity where you have EditText.

android:windowSoftInputMode="adjustPan"
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
Nitin Bathija
  • 800
  • 3
  • 12
  • 24