2016年7月27日 星期三

Recyclerview after rotate,the iteam sort has problem

solved

1. use the new version
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'


2.

after swap the data,create a new layout manager

myrecycleViewadapter.swapCursor(data); 
        } 

        if (mainActivity.getIsTwoPlanMode() && !isPortrait()) { 
            mLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL); 
        } else { 
            mLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); 
        } 

        myRecyclerView.setLayoutManager(mLayoutManager); 

2016年7月10日 星期日

Accessibility of the android application

Accessibility of the android application
the four step of accessibility
  1. Add descriptive text to user interface controls in your application using the android:contentDescription attribute. Pay particular attention to ImageButton, ImageView and CheckBox.
  2. Make sure that all user interface elements that can accept input (touches or typing) can be reached with a directional controller, such as a trackball, D-pad (physical or virtual) or navigationgestures .
  3. Make sure that audio prompts are always accompanied by another visual prompt or notification, to assist users who are deaf or hard of hearing.
  4. Test your application using only accessibility navigation services and features. Turn on TalkBack and Explore by Touch, and then try using your application using only directional controls. For more information on testing for accessibility, see the Accessibility Testing Checklist.

Content Describtion
important for:
check box
Image button
image view

decorative graphic ‘s contentDescription set to null

Text field hints: For EditText fields, provide an android:hint attribute instead of a content description, to help users understand what content is expected when the text field is empty and allow the contents of the field to be spoken when it is filled.



in XML:
<ImageButton
   android:id=”@+id/add_note_button”
   android:src=”@drawable/add_note”
   android:contentDescription=”@string/add_note”/>


in java code:

setContentDescription(CharSequence)