2017-05-12 10 views
0

私のAndroidアプリケーションでは、ListViewがあり、ヘッダには2 editTextが含まれています。 editTextにフォーカスしようとすると、キーボードが表示され、フォーカスが上部のeditTextに変わります。ヘッダーレイアウトのxml:キーボードのeditTextを変更できないようにする

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" android:layout_height="match_parent"> 
    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/name" 
     android:hint="Title" 
     android:layout_alignParentTop="true"/> 
    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:nextFocusUp="@id/name" 
     android:inputType="text" 
     android:hint="Wordpack description" 
     android:id="@+id/description" 
     android:layout_below="@+id/name" /> 
    <Button 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/description" 
     android:inputType="text" 
     android:id="@+id/locale" 
     android:text="Select language"/> 
</RelativeLayout> 

enter image description here

+0

あなたは 'アンドロイド削除しようとしたことがあり:nextFocusUp'タグを? –

+0

@PabloBaxter問題がまだ発生します – Feelfree

答えて

1

ListViewコントロールにフォーカスを取り、あなたはそれをタップすると最初の子にそれを与えているように思えます。このanswerをチェックしてください。その要旨を、あなたがマニフェストにあなたの活動に以下を追加する必要があります。

android:windowSoftInputMode="adjustPan" 

をそしてあなたのリストビューにこれを追加します。

android:descendantFocusability="beforeDescendants" 
+0

これは副次的な解決策かもしれません:http://stackoverflow.com/questions/6918494/edit-text-in-listactivity-listview-loses-focus-when-keyboard-comes-up/15294709# 15294709 –

+0

2番目の解決方法ではまだ問題が発生しますが、 'android:windowSoftInputMode =" adjustPan'が動作しました。 – Feelfree

関連する問題