2014-03-25 52 views
0

我有一个ListView包含多个EditText。有时候,当我滚动并专注于EditText时,虽然键盘正在显示并且我可以正常输入字符,但光标消失。当我放置第一个字符时,光标就会出现。ListView中的Edittext丢失光标

<EditText 
      android:id="@+id/et_nutri_lo" 
      android:background="@drawable/edit_text_corner" 
      android:paddingRight="@dimen/et_corner_radius" 
      style="@android:style/TextAppearance.Medium" 
      android:selectAllOnFocus="true" 
      android:layout_width="wrap_content" 
      android:layout_height="@dimen/btn_small_h" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="1" 
      android:minEms="3" 
      android:maxEms="6" 
      android:gravity="right|bottom" 
      android:inputType="numberDecimal" 
      android:filterTouchesWhenObscured="false" 
      /> 

你知道怎么回事吗?

谢谢

+0

您能否显示edittext的属性? – Sree

+0

@Sreekanthss:我更新了我的EditText上述 – lolyoshi

+0

给这个命令到你的ListView的android:descendantFocusability = “afterDescendants” 或Android:descendantFocusability = “beforeDescendants” – Sree

回答

3

你有没有机会设置一个OnFocusChangeListener?如果是,请尝试以下操作:

view.setOnFocusChangeListener(new OnFocusChangeListener() { 
    @Override 
    public void onFocusChange(View view, boolean hasFocus) { 
     [YOUR CODE HERE] 
     view.dispatchWindowFocusChanged(hasFocus); // Fix for text selection handle not disappearing 
    } 
}); 
+0

非常准确的答案男人!保持它! –