总结 2017.12.18

来源:互联网 发布:烘焙成本核算软件 编辑:程序博客网 时间:2024/05/29 04:54

手机微信通讯录右侧字母的实现:


新创建一个布局用来编辑我们所需要的字母部分,主要是应用相对布局里控件的排序的掌握,具体代码如下

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical" android:layout_width="match_parent"    android:layout_height="match_parent">    <ScrollView        android:layout_width="match_parent"        android:layout_height="match_parent">        <RelativeLayout            android:layout_width="match_parent"            android:layout_height="match_parent"            >            <RelativeLayout                android:layout_alignParentRight="true"                android:layout_width="10dp"                android:layout_height="match_parent">                <TextView                    android:id="@+id/A"                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:textSize="14sp"                    android:text="\n\n\n↑A"></TextView>     </RelativeLayout>        </RelativeLayout>    </ScrollView> </RelativeLayout>

代码只举例出字母A的编辑方法,其余字母代码同理



其次在我们事先画好的通讯录布局,应用include 来引用我们的字母部分,即可实现向下滑动时,字母也跟随的滑动