私は、人々がExplore by TouchおよびTalkBackアクセシビリティサービスを使用してアプリケーションを使用する、アクセス可能なAndroidアプリケーションを開発しています。
これは私の Android XML コードです:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/forename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_marginLeft="15dip"
android:textSize="20sp"
android:text="@string/forenameText"
android:contentDescription="@null"/>
<EditText
android:id="@+id/EditTextForename"
android:layout_width="285dp"
android:layout_height="65dp"
android:layout_marginTop="10dip"
android:layout_marginLeft="15dip"
android:hint="@string/forenameHint"
android:inputType="textPersonName"
android:lines="1"
android:singleLine="true"
android:textSize="20sp" >
</EditText>
</LinearLayout>
文字列.xml
<string name="forenameText">Forename</string>
<string name="forenameHint">Enter your forename here</string>
TextView には「Forename」というタイトルが表示され、EditText ではフォーム フィールドに詳細を入力できます。私が抱えている問題は、Explore by Touch を使用して画面上で指をドラッグすると、TalkBack が TextView のタイトルを取得し、それを "Forename" として読み上げるということです。TextView にテキストのみを表示し、可聴フィードバックを提供しないようにします。
上記のコードからわかるように、contentDescription を @null に設定しましたが、TextView の上に指を置くと、TalkBack は引き続き "Forename" を読み上げます。
また、Java クラスで contentDescription を設定しようとしました。
TextView forename=(TextView)findViewById(R.id.forename);
forename.setContentDescription("");
しかし、私はまだ同じ問題を抱えています。contentDescription を null/空に設定して、TalkBack がそれをアナウンスしないようにする他の方法はありますか?
Java コード:
public class MainActivity extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View forename = findViewById(R.id.forename);
forename.setAccessibilityDelegate(new AccessibilityDelegate() {
public boolean performAccessibilityAction (View host, int action, Bundle args){
return true;
}
});
}
}