मैंने निम्न कार्यक्षमता का परीक्षण करने के लिए एक छोटा सा अनुप्रयोग बनाया है। जब मेरी गतिविधि लॉन्च होती है, तो उसे सॉफ्टकीबोर्ड के साथ लॉन्च करने की आवश्यकता होती है।शो सॉफ़्ट इनपुट के साथ एंड्रॉइड शो सॉफ्टकीबोर्ड काम नहीं कर रहा है?
मेरा कोड काम नहीं करता है ?!
मैंने कोड में मैनिफेस्ट और विभिन्न झंडे में इनपुट "विधि" में विभिन्न "राज्य" सेटिंग्स की कोशिश की है।
मैंने एंड्रॉइडमैनीफेस्ट.एक्सएमएल में सेटिंग शामिल की है और स्पष्ट रूप से केवल एक ही गतिविधि के निर्माण में शामिल किया है।
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.android.studyIme"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".StudyImeActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysVisible">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
... मुख्य लेआउट (main.xml) ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<EditText
android:id="@+id/edit_sample_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/hello"
android:inputType="textShortMessage"
/>
</LinearLayout>
... और कोड ...
public class StudyImeActivity extends Activity {
private EditText mEditTextStudy;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mEditTextStudy = (EditText) findViewById(R.id.edit_study);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mEditTextStudy, InputMethodManager.SHOW_FORCED);
}
}
हम्म ... मैंने बस अपने स्प्रिंट एलजी ऑप्टिमस फोन पर डिफ़ॉल्ट "हैलोवर्ल्ड" गतिविधि (यानी, SHOW_FORCED कोड सहित) के साथ यह कोशिश की और यह अपेक्षा के अनुसार काम किया। क्या यह संभव है कि सुविधा डिवाइस (ओएस स्थापित) निर्भर है ?? जब मैं घर जाता हूं तो मैं अपने अन्य उपकरणों (एचटीसी, जी 2 और माई टच) पर फिर से परीक्षण करूंगा। – mobibob
कृपया मेरा जवाब यहां देखें, मैंने नीचे दी गई सभी तकनीकों का प्रयास किया है, लेकिन यह काम करता है: http://stackoverflow.com/a/37529370/3900270 – strangetimes