2016-11-27 9 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

私は、リモートコントロールが使用されているときにフォーカスをScrollViewから移動できるようにするために、ScrollView内の先頭の要素に対して、android:nextFocusUp = "@ id/buttonAboveScrollView"を使用しています。

関連する問題