편집을 마친 후에 안드로이드 대화 상자에 EditText (searcField)가 있습니다. 대화 상자를 닫습니다.안드로이드 대화 상자의 clearFocus가 작동하지 않습니다.
다른 EditText로 이동하면 포커스는 여전히 searchField에 있습니다.
아이디어가 있으십니까?
감사
편집 : 여기에 게시 할 너무 많이가,이 조금 내 문제를 이해하는 데 도움이 될 수 있기를 바랍니다.
고객 대화보기
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:orientation="horizontal" >
<EditText
android:id="@+id/search_field"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="left"
android:inputType="textNoSuggestions|textVisiblePassword"
android:layout_weight="0.70"
android:hint="type item name to search"/>
</LinearLayout>
<ListView
android:id="@+id/itemList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#00000000"
android:descendantFocusability="beforeDescendants"
android:scrollbars="none"/>
</LinearLayout>
자바 코드
View searchView = getActivity().getLayoutInflater().inflate(R.layout.search, null, false);
EditText searchField = (EditText)productEditView.findViewById(R.id.search_field);
searchField.addTextChangedListener(this);
...
public void afterTextChanged(Editable text) {
if (searchField.hasFocus()) {
Log.i("MyApp", "searchField is still focused");
return;
}
if (otherField.hasFocus()){
Log.i("MyApp", "other field");
return;
}
}
당신은 초점이 표시되어 있지 않은 대화 상자의 필드에 말을? 초점이 맞다는 것을 어떻게 아십니까? – invertigo
네, 맞습니다. 초점은 여전히 대화 상자에 있습니다. addTextChangedListener를 사용하여 모든 textFields를 등록했습니다. 그런 다음 afterTextChanged 콜백에서 (searchField.hasFocus())를 확인합니다. 항상 true입니다. – triston
어쩌면 코드를 게시하여 – invertigo