#StackBounty: #android Cant navigate to button outside of scrollview with keyboard navigation

Bounty: 50

I have a layout that has a header, footer and a scrollview in between

This is my layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/header"
        android:text="@string/player_settings" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/footer"
        android:layout_below="@id/header">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/text_margin"
            android:orientation="vertical">

        .....

            <Button
                android:id="@+id/start"
                android:layout_marginStart="@dimen/text_margin"
                android:layout_marginTop="@dimen/text_margin"
                android:paddingStart="@dimen/button_padding"
                android:paddingEnd="@dimen/button_padding"
                android:text="Start" />

            <Button
                android:id="@+id/close"
                android:layout_marginStart="@dimen/text_margin"
                android:layout_marginTop="@dimen/text_margin"
                android:layout_marginBottom="32dp"
                android:paddingStart="@dimen/button_padding"
                android:paddingEnd="@dimen/button_padding"
                android:text="Close"
                android:nextFocusDown="@+id/save"/>

        </LinearLayout>

    </ScrollView>

    <LinearLayout
        android:id="@+id/footer"
        android:layout_alignParentBottom="true">

        <Button
            android:id="@+id/save"
            android:layout_marginStart="16dp"
            android:text="Save" />

    </LinearLayout>

</RelativeLayout>

The app is going to be used with a keyboard so I am using the arrow buttons to navigate and when I get the the bottom of the scrollview to the close button it should go to the save button but it just stays at the close button. As you can see I even set the nextFocusDown to be the save button but it still does not go.

Any ideas why it gets stuck on the button and never navigates to the save button outside the scrollview?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.