我有一個佈局,其中有一個按鈕,後面跟着一個ListView。我遇到的問題是當按鈕有焦點(背景爲橙色),並且我在我的鍵盤上按下DOWN時,ListView的第一行沒有焦點。將焦點從按鈕移動到ListView時出現問題
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageButton android:id="@+id/button" style="@android:style/Button"/>
</LinearLayout>
<ListView android:id="@+id/action_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
這是每行的ListView控件的佈局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:focusable="true"
><TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
我已經使用 '機器人:nextFocusDown' 嘗試屬性,但是這並不能幫助我的問題:
<ImageButton android:id="@+id/button" style="@android:style/Button"/>
</LinearLayout>
<ListView android:id="@+id/action_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusUp="@id/button"
/>
任何想法如何解決這個焦點問題?當我按DOWN時,我基本上想要將焦點移動到ListView的第一行。當我按下UP時,ListView的第一行將焦點移動到按鈕上。
謝謝。