Abhijit Shelke
Abhijit Shelke

Reputation: 11

Soft key board hiding edit text

In my application main screen is having tab host with four tabs at bottom.

RealTabContaint of the tabhost is replace by relative fragments.

In one fragment there is another tabhost with two tabs at the top. One of the tab is associated with an Activity which layout consist of 4 textviews & one List view. When ever I tried to type in 3 rd & 4 th textviews the soft KeyBoards hide that Edittexts. User is not able to see what he is typing.

I tried :

android:windowSoftInputMode="adjustPan|adjustResize"

I am not able to put scroll view in main 4 Tabs screen as well as in activity layout. So, now I am hidding 1st & 2nd EditText when focus comes to 3 rd & 4 th editbox.

Its working but gives problem some time & I think this is a not good practice. I searched a lot & tried a lot but didnt finding any solution.

If any one is having solution Please....

Upvotes: 0

Views: 557

Answers (2)

Vishnu
Vishnu

Reputation: 184

I too had the same problem. But the problem solved by using

android:windowSoftInputMode="stateVisible|adjustPan" 

within the activity in Manifest file.

Upvotes: 1

Dev
Dev

Reputation: 3580

call this function

       private void hideSoftKeyboard(EditText editText){
    if(getCurrentFocus()!=null && getCurrentFocus() instanceof EditText){
        InputMethodManager imm =       (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
    }

Upvotes: 0

Related Questions