friddle
friddle

Reputation: 1347

when focus EditText ,EditText didnot pop out the SoftKeyboard

Yes.It is my question.When I using edittext in my layout.when I focus or touch the Edittext,them didnot pop out the soft keyboard.

this is my layout:

```

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:focusable="false"
        android:orientation="vertical"
        android:weightSum="1.0" >

        <RelativeLayout
          ...........................
          ...........................
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:focusable="false"
            android:gravity="center"
            android:orientation="horizontal"
            android:weightSum="1.0" >

            <EditText
                android:id="@+id/detail_query_txt"
                android:paddingTop="15dp"
                android:layout_alignParentTop="true"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:gravity="center"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:inputType="phone" >

                <requestFocus />
            </EditText>

            <Button
                android:id="@+id/detail_query_but"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/detail_query_txt"
                android:focusable="false"
                android:text="@string/word_query" />
        </RelativeLayout>
    </LinearLayout>

</ScrollView>

``` Now:I didnot write any code in my java class file

I try all the way the Network tell us,all it failed. this is the way i test: android:windowSoftInputMode="stateVisible" add to Activity in Mainifest ----> failed
it pop out the Soft keyboard,but pointer to class,not the edittext

and so on...
someone help me to solve the problem.

Upvotes: 0

Views: 353

Answers (3)

Siddharth_Vyas
Siddharth_Vyas

Reputation: 10100

Remove android:descendantFocusability="blocksDescendants" from your LinearLayout. I tried your code, it worked.

Hope it helps.

EDIT :

Explaination:

the attribute android:descendantFocusability="blocksDescendants" simply blocks your LinearLayout to give focus to the decendant view .

Decendants of LinearLayout= all the child views of LinearLayout

Upvotes: 1

Nagaraja
Nagaraja

Reputation: 581

Use this code in the point where you want to display the keyboard (may be in oCreate?)

EditText mEditText= (EditText) findViewById(R.id.editTextName-);

    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
        .showSoftInput(mEditText, InputMethodManager.SHOW_FORCED);

Upvotes: 0

Hariharan
Hariharan

Reputation: 24853

You can try this..

    <activity
         android:name="Activity"
         android:windowSoftInputMode="adjustPan"/>

Upvotes: 0

Related Questions