Android 如何水平显示联系人字母表列表?

Android 如何水平显示联系人字母表列表?,android,contacts,Android,Contacts,我正在尝试实现一个联系人列表及其字母栏。 我已经搜索了很多,但无论我得到什么样的例子,都是垂直显示字母表列表,但我需要在联系人网格视图上方水平显示字母表列表 我有一些使用listview的例子,但我需要在触摸屏上滚动,所以我认为listview不是一个好主意 编辑:请查看以下内容。我能做的就是这样的链接 A B C 但是我需要一个B C。。等等 任何链接或示例都非常值得注意 谢谢编辑1 把整个布局改成这个 我想说的是,只需玩你自己可以做的代码 <?xml version="1.0

我正在尝试实现一个联系人列表及其字母栏。 我已经搜索了很多,但无论我得到什么样的例子,都是垂直显示字母表列表,但我需要在联系人网格视图上方水平显示字母表列表

我有一些使用listview的例子,但我需要在触摸屏上滚动,所以我认为listview不是一个好主意

编辑:请查看以下内容。我能做的就是这样的链接

A

B

C

但是我需要一个B C。。等等

任何链接或示例都非常值得注意

谢谢

编辑1 把整个布局改成这个

我想说的是,只需玩你自己可以做的代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:baselineAligned="false"
    android:orientation="vertical" >
    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight=".9"
        android:fastScrollEnabled="true" />
    <LinearLayout
        android:id="@+id/sideIndex"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#FFF"
        android:gravity="center_horizontal"
        android:orientation="horizontal" >
    </LinearLayout>
</LinearLayout>


这是不可能的,列表视图只是垂直的。
你不能使它水平。 但是,您可以将水平滚动视图实现为水平列表视图。
但是它很难控制水平滚动视图的滚动,因为它没有setOnScrollListener

<HorizontalScrollView
        android:id="@+id/horizontalScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <Button
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="Click here before scroll listview"
                android:onClick="Action"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 1" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 2" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 3" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 4" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 5" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 6" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 7" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 8" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="My button 9" />
        </LinearLayout> 
    </HorizontalScrollView>

那么您到底需要什么?