Android accessibility focus - clicking a view changes focus to previous view

Posted by benkdev on Stack Overflow See other posts from Stack Overflow or by benkdev
Published on 2012-09-25T21:35:33Z Indexed on 2012/09/25 21:37 UTC
Read the original article Hit count: 441

Filed under:
|
|
|

I'm using android TalkBack to test my application for accessibility use. When I swipe to select a view and double tap, the focus returns the the view above it. Usually when swiping to a view and double clicking it, onClick is called. What am I doing wrong?

<?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"
    android:background="@color/all_white"
>
<ImageView   
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/header"
    android:scaleType="center"
/>
<ImageView   
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/green_bar"
    android:scaleType="center"
/>  
<ImageView   
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/blue_bar"
    android:scaleType="center"
/>
<EditText
    android:id="@+id/username"
    android:layout_width="325dp"
    android:layout_height="wrap_content"
    android:hint="@string/username"
    android:focusable="true"
    android:nextFocusDown="@id/password"
 />
<EditText
    android:id="@+id/password"
    android:inputType="textPassword"
    android:layout_width="325dp"
    android:layout_height="wrap_content"
    android:hint="@string/password"
    android:focusable="true"
    android:nextFocusUp="@id/username"
    android:nextFocusDown="@id/login"
/>
<Button
    android:id="@+id/login"
    android:onClick="doLogin"
    android:focusable="true"
    android:layout_width="325dp"
    android:layout_height="wrap_content"
    android:text="@string/login"
    android:nextFocusUp="@id/password"
    android:nextFocusDown="@id/create_trial_account"
/>
<Button
    android:id="@+id/create_trial_account"
    android:layout_width="100dip"
    android:layout_height="wrap_content"
    android:text="@string/new_user"
    android:onClick="createAccount"
    android:focusable="true"
    android:nextFocusUp="@id/login"
 />
<TextView
    android:id="@+id/copyright"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/copyright"
  />        
 <TextView
    android:id="@+id/buildNumber"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
 />
</LinearLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about onclick