カスタムアダプターを備えたものListView
があります(文字列を保存します)。それぞれrow
に が 1 つ含まれていますEditText
。
アクティビティのレイアウト:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fdf7e9"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="0.16"
android:background="@drawable/top_bar" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical"
android:padding="5dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/editAccount"
android:textColor="#fffdf8eb" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="0.72"
android:orientation="vertical" >
<ListView
android:id="@+id/listPhoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fdf7e9"
android:cacheColorHint="#fdf7e9"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:fadingEdgeLength="15dip"
android:footerDividersEnabled="false"
android:focusable="false"
android:headerDividersEnabled="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/bottomBtns"
style="@android:style/ButtonBar"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.13"
android:background="@drawable/bottom_bar"
android:baselineAligned="true"
android:orientation="horizontal" >
<Button
android:id="@+id/updateAccount"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:text="@string/menu_quit_account" />
<Button
android:id="@+id/cancelEditAccount"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:text="@string/cancel" />
</LinearLayout>
</LinearLayout>
行のレイアウト:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fffdf7e9"
android:longClickable="true"
android:orientation="horizontal"
android:descendantFocusability="beforeDescendants"
android:paddingBottom="5dip"
android:paddingTop="5dip" >
<TextView
android:id="@+id/phoneNumberDescript"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:text="č. 1 : "
android:textColor="#ad865d"
android:width="50dip" />
<EditText
android:id="@+id/phoneNumberText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginRight="55dp"
android:layout_toRightOf="@+id/phoneNumberDescript"
android:focusable="true"
android:paddingLeft="10dip"
android:singleLine="true"
android:textColor="#ff3c2415" />
<ImageButton
android:id="@+id/deletePhoneNumber"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dip"
android:background="@drawable/delete" />
<TextView
android:id="@+id/numberId"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="invisible" />
</RelativeLayout>
私が欲しいもの:
ListView で EditText をクリックすると、レイアウト全体を表示して、自分が書き込んでいる内容を確認したいと考えています。
問題:
クリックした後、最初の文字を EditText に書き込むか、フォーカスされた EditText を再度クリックするまで、レイアウト全体が押し上げられます。その後、レイアウトは下にスクロールしますが、入力を書き続けることができるため、フォーカスを失うことはありませんが、ソフトキーボードによって隠されているため、何を書いているのかわかりません。
ListView にはヘッダーとフッターもあり、EditTextes もあります。これらの EditTextes を使用しても問題は同じです。最初の文字の後、またはそれを繰り返しクリックした後、レイアウトは通常の位置にスクロールして戻ります。
私が持っているマニフェストでandroid:windowSoftInputMode="adjustPan"
私も試しましたnumbersListView.setItemsCanFocus(true)