【发布时间】:2013-12-31 12:15:43
【问题描述】:
我有一个 ListView 和一个 EditText ;当我触摸EditText 时,会出现软键盘并且我已经输入了一些文字,没关系。但是输入文本后,按退格键(不是后退键),活动就结束了。
为什么会这样?这里出了什么问题?我该如何解决这个问题? 请有人帮我找出这个谜语。
在 xml 中。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="15"
android:textColor="#000000"
android:background="@drawable/back"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comments"
android:textColor="#000000"
android:visibility="gone"/>
<TextView
android:id="@+id/notes_to_parents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
在java中。 此 for 循环位于 Listview onScroll Action 内。
for (int i = 0; i < daily_dairy_2.getChildCount(); i++)
{
LinearLayout layout = (LinearLayout) daily_dairy_2.getChildAt(i);
final EditText notes_to = (EditText) layout.getChildAt(0);
}
我知道在这里我不会为 edittext 编写任何代码。如何处理这个编辑文本。
【问题讨论】:
-
发布您的 logcat 错误
-
没有崩溃,所以在 logcat 中什么也没有。
-
输入您的代码,以便我们识别问题..
-
这里我使用 Listview 并使用 simpleadapter 加载此布局。
标签: android android-layout listview android-softkeyboard