Android people 应用程序的详细 View 开发

标签 android android-layout android-listview android-linearlayout android-contacts

我正在开发一个 android 应用程序,其中包含人员详细信息 View 等 Activity ,但我不知道如何显示电子邮件、电话和其他数据的列表,因为我正在从数据库中检索这些信息,我需要实现与人脉应用相同的布局。

enter image description here

到目前为止我尝试了什么:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <HorizontalScrollView
                android:id="@+id/hori_scroll"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal">

                </LinearLayout>
            </HorizontalScrollView>
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="15dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginBottom="10dp">
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="DADOS DO CLIENTE"
                        android:textSize="20dp"
                        android:textColor="#50A7B3"
                        android:layout_marginBottom="5dp"/>
                    <View
                        android:layout_height="1dp"
                        android:layout_width="match_parent"
                        android:background="#728C93"/>
                    <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <LinearLayout
                            android:layout_marginTop="10dp"
                            android:orientation="vertical"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="left"
                            android:layout_weight="0.60">
                            <TextView
                                android:id="@+id/nome"
                                android:layout_height="wrap_content"
                                android:layout_width="wrap_content"
                                android:text="NomeCliente"
                                android:textSize="20dp"
                                android:textColor="#696969"
                                android:layout_marginBottom="5dp"/>
                            <TextView
                                android:id="@+id/tipoPessoa"
                                android:layout_height="wrap_content"
                                android:layout_width="wrap_content"
                                android:text=""
                                android:textSize="20dp"
                                android:textColor="#6D6D6D"
                                android:layout_marginBottom="5dp"/>
                        </LinearLayout>
                        <LinearLayout
                            android:layout_marginTop="10dp"
                            android:orientation="vertical"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="right"
                            android:layout_weight="0.40">

                        </LinearLayout>
                    </LinearLayout>
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="ENDEREÇO"
                        android:textSize="20dp"
                        android:textColor="#50A7B3"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <View
                        android:layout_height="1dp"
                        android:layout_width="match_parent"
                        android:background="#728C93"/>
                    <TextView
                        android:id="@+id/enderecoId"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:visibility="gone"
                        android:textSize="20dp"
                        android:textColor="#696969"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <TextView
                        android:id="@+id/endereco"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="xxxxxxxxxxxxxx"
                        android:textSize="20dp"
                        android:textColor="#696969"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="TELEFONE"
                        android:textSize="20dp"
                        android:textColor="#50A7B3"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <View
                        android:layout_height="1dp"
                        android:layout_width="match_parent"
                        android:background="#728C93"/>
                    <TextView
                        android:id="@+id/telefone"
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="xxxxxxxxx"
                        android:textSize="20dp"
                        android:textColor="#6D6D6D"
                        android:layout_marginBottom="5dp"/>
                    <LinearLayout 
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                        <ListView android:id="@id/android:list"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"/>
                        <TextView android:id="@id/android:empty"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Empty"/>
                    </LinearLayout>


                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="EMAIL"
                        android:textSize="20dp"
                        android:textColor="#50A7B3"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <View
                        android:layout_height="1dp"
                        android:layout_width="match_parent"
                        android:background="#728C93"/>
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="xxxxxxxxx"
                        android:textSize="20dp"
                        android:textColor="#6D6D6D"
                        android:layout_marginBottom="5dp"/>
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="CONTATOS"
                        android:textSize="20dp"
                        android:textColor="#50A7B3"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <View
                        android:layout_height="1dp"
                        android:layout_width="match_parent"
                        android:background="#728C93"/>
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="xxxxxxxxxxxxxx"
                        android:textSize="20dp"
                        android:textColor="#696969"
                        android:layout_marginBottom="5dp"
                        android:layout_marginTop="10dp"/>
                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="xxxxxxxxx"
                        android:textSize="20dp"
                        android:textColor="#6D6D6D"
                        android:layout_marginBottom="5dp"/>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

详细信息:

  lv = (ListView) findViewById(R.id.lista);

        tel = new ArrayList<TelefoneModel>();



            Repositorio mRepositorioTelefones = new Repositorio(this);
            List mTelefones = mRepositorioTelefones.getTelefonesDoCliente(Integer.valueOf(rm_IdCliente));


            tel = mTelefones;

            ads = new TelefoneViewAdapter(getApplicationContext(), this, tel);

            telAdapter(true);


            lv.setAdapter(ads);

ListView :

                         <LinearLayout 
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content">
                            <ListView android:id="@id/android:list"
                                android:layout_width="fill_parent"
                                android:layout_height="fill_parent"/>
                            <TextView android:id="@id/android:empty"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Empty"/>
                        </LinearLayout>

最佳答案

您要开发的 View 似乎很适合 ViewPager .顶部将是一个 ViewPager

Layout manager that allows the user to flip left and right through pages of data.

至于下面有蓝线的“Phone”,它是一个带有section separator的TextView。您可以按如下方式实现:

<TextView
    android:id="@+id/address_label"
    style="?android:attr/listSeparatorTextViewStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Address"/>  

来源:Adding "section dividers" to my layout?

关于Android people 应用程序的详细 View 开发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26167933/

相关文章:

android - 如何从 XML 布局文件创建自定义 CardView 对象?

android - 像在新的 GMail 应用程序中一样从侧面滑出 ListView

android - 在深色和浅色通知状态栏图标之间切换

android - 我有 edittext 填充问题

android - 添加额外的图像/图标到 CardFragment (Android Wear)

java - 安卓 ListView : How to add a row with a buttonclick

android - ionic > 找不到模块 'ansi'

android - 基于 XML 的图形与 png 可绘制对象?

android - 滚动时自定义 ListView 中的错误

Android 实现带拉动刷新的 SwipeListView