开发者

Softkeyboard not displaying in 2.2 landscape mode

I am facing a strange problem. My app works fine in 2.1 (emulator + device). But, when I use 2.2 (both emulator + device) then there is an issue 开发者_开发问答with the soft keyboard. There is a Activity in landscape mode in the app (use android:screenOrientation="landscape"). There are two EditText in that Activity. But, soft keyboard is not displaying for those. In fact, softkeyboard seems to apprear, but as a bar in the bottom. Please view the screenshot.

Softkeyboard not displaying in 2.2 landscape mode

Any help will be appreciated. Regards Sarwar Erfan

tried different things for android:windowSoftInputMode , did not work

<Activity android:name=".PriceCalculator" 
    android:screenOrientation="landscape" 
    android:windowSoftInputMode="stateAlwaysVisible|adjustPan" 
    android:configChanges="orientation" 
    android:label="Pricing Calculator">
    ....
</Activity>


<EditText 
    android:id="@+id/adhesiveUnitPrice" 
    android:inputType="numberDecimal" 
    android:imeOptions="actionDone|flagNoExtractUi" 
    android:layout_column="4" android:gravity="right"/> 


I found out that, in 2.3, the softkeyboard wont show up in landscape mode if the emulator or the device has an hardware keyboard.


I had a similar problem with my code (see example here bellow). FYI, replacing "InputMethodManager.SHOW_IMPLICIT" by "InputMethodManager.SHOW_FORCED" solved the issue.

public class Main extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    EditText et = (EditText)findViewById(R.id.et);

    et.setFocusableInTouchMode(false);

    final Context context = this;

    et.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            v.requestFocusFromTouch();

            InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(v, InputMethodManager.SHOW_FORCED);

        }
    });

}

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜