Mam problemy z kontrolowaniem ostrości. Poniżej moja definicja interfejs posiada:requestFocus pomijam następny EditText
źródło (RadioGroup/opcja) docelowy (EditText) ilość (EditText) transferu (przycisk)
mam zmianę widoczności "źródła" do mojego kodu. Gdy czasy, w których go nie wyświetlam, fokus automatycznie przechodzi do "ilości", której oczekiwałbym zamiast tego "przeznaczenia". Nie wiem, czego mi brakuje. Podejrzewam, że to może być błąd Androida, nie wiem. Czy jest ktoś, kto wie, jak rozwiązać ten problem?
Dzięki
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RadioGroup android:id="@+id/source"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<RadioButton android:id="@+id/default"
android:checked="false"
android:text="@string/default"/>
</RadioGroup>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="@string/destination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#ffffff"
android:paddingRight="10sp"
android:layout_weight="1"/>
<EditText android:id="@+id/destination"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"><requestFocus/></EditText>
</TableRow>
<TableRow>
<TextView
android:text="@string/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#ffffff"
android:paddingRight="10sp"
android:layout_weight="1"/>
<EditText android:id="@+id/quantity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"/>
</TableRow>
</TableLayout>
<Button android:id="@+id/transfer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/transfer"/>
</LinearLayout>
Testuję to na Androidzie 2.2 i nie mogę się odtworzyć, na początku koncentruję się na celu. Jeśli nadal będziesz mieć problemy, polecam dodać 'EditText e = (EditText) findViewById (R.id.destination); e.requestFocus(); 'w twojej metodzie" onResume ". –
Dzięki za odpowiedź. Tak, ale testuję w systemie Android 2.1. Funkcja requestFocus() nie może rozwiązać problemu. – pocoa
Zobacz moją odpowiedź w temacie: http://stackoverflow.com/a/13194129/348192 – iBog