2016-11-27 26 views
0

的應用程序有一個佈局如下:如何使用遙控器將焦點移出Android上的ScrollView?

<LinearLayout 
    android:id="@+id/linearLayoutContents" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal"> 
       <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:focusable="true" 
        android:minWidth="120dip" 
        android:focusableInTouchMode="true" 
        android:text="@string/set_up"> 
        <requestFocus /> 
       </Button> 
       ... 
    </LinearLayout> 
    <ScrollView 
     android:id="@+id/scrollViewNewDevice" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"> 
     //Some EditText and AutoCompleteTextView controls 
    </ScrollView> 
</LinearLayout> 

您可以看到按鈕獲得焦點intially。一旦焦點移動到ScrollView中,它就不會用遙控器擺脫它。任何人都可以提供關於如何通過遙控器將焦點從ScrollView中移出的提示嗎?

回答

0

我正在使用android:nextFocusUp =「@ id/buttonAboveScrollView」作爲ScrollView中的頂層元素,以便在使用遙控器時允許焦點移出ScrollView。

相關問題