Android Contact Full effect (bottom), fast scrolling alphabet

Source: Internet
Author: User
Tags xmlns

In the previous article, I worked with you to implement the group navigation and extrusion animation features similar to the Android contact, but since the article is called the Android contact Full effect implementation, there is no quick scrolling feature that is clearly not "full". So this article I will lead you to the code based on the previous article to improve, add the fast scrolling function.

If you haven't read my previous article, please hurry up and read the Android contact full effects (top), group navigation and extrusion animation.

In fact, ListView itself has a fast scrolling property that can be enabled by setting android:fastscrollenabled= "true" in the XML. This is the way to quickly scroll, including previous versions of Android contacts. The effect is shown in the following illustration:

But the fast-scrolling approach is ugly, and many mobile phone makers later changed their default fast scrolling to a A-Z alphabet like the one on the iphone when customizing their ROM. How can we lag behind the tide of the times here? Our fast scrolling also uses a-Z alphabet!

The following is the beginning of implementation, first open the last Contactsdemo project, modify the Activity_main.xml layout file. Since we're going to add the alphabet to the interface, we need a button that sets the background of the button to a A-Z-sorted picture and then aligns right. A textview is also needed to display the current grouping on a pop-up grouping layout, which is gone by default and is only shown when the finger slides on the alphabet. The modified layout file code is as follows:

<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 "Android:or" ientation= "vertical" > <listview android:id= "@+id/contacts_list_view" Android:layout_wi Dth= "Fill_parent" android:layout_height= "Wrap_content" android:layout_alignparenttop= "true" Androi D:scrollbars= "None" android:fadingedge= "None" > </ListView> <linearlayout A Ndroid:id= "@+id/title_layout" android:layout_width= "fill_parent" android:layout_height= "18dip" and Roid:layout_alignparenttop= "true" android:background= "#303030" > <textview andr
            Oid:id= "@+id/title" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:layout_gravity= "Center_horIzontal "android:layout_marginleft=" 10dip "android:textcolor=" #ffffff "Android:textsiz E= "13sp"/> </LinearLayout> <button android:id= "@+id/alphabetbutton" an Droid:layout_width= "Wrap_content" android:layout_height= "fill_parent" android:layout_alignparentright= "Tru" E "android:background=" @drawable/a_z "/> <relativelayout android:id=" @+id/s Ection_toast_layout "android:layout_width=" 70dip "android:layout_height=" 70dip "Android:layout_cen  
        Terinparent= "true" android:background= "@drawable/section_toast" android:visibility= "Gone" >
            <textview android:id= "@+id/section_toast_text" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:layout_centerinparent= "true" Android:textcolor = "#fff" AndrOid:textsize= "30sp"/> </RelativeLayout> </RelativeLayout> 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.