3

사람들의 세부 정보보기와 같은 활동으로 Android 앱을 개발하고 있지만 이메일, 휴대 전화 및 기타 데이터 목록을 표시하는 방법을 모르겠습니다. 정보를 데이터베이스에서 얻으려면 사람 패키지와 동일한 레이아웃을 구현해야합니다. Android 앱의 세부 정보보기

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); 

목록보기가 :

      <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> 
+1

는 그것은 단면의 ListView, 헤더 (전화, 이메일, IM) 등의 각 섹션을 사용합니다. 당신은 GROUP BY 문장으로 데이터베이스를 쿼리해야만합니다. 어떤 종류의 정보 (전자 메일, 전화, 메신저 등)를 알기 위해 "종류"열의 이름을 알지 못합니다. –

+0

@DavidCorsalini는 그 구현의 온라인 예제가 있습니까? – jgandroid

+0

http://javatechig.com/android/listview-with-section-header-in-android 첫 번째 Google 검색 결과입니다. –

답변

1

당신이 개발하려는 뷰는 것 같아를ViewPager에 대한 좋은 후보. 상단 부분은 ViewPager입니다.

사용자가 데이터 페이지를 통해 좌우로 뒤집을 수있는 레이아웃 관리자입니다.

파란색 줄이있는 "전화 번호"는 섹션 구분 기호가있는 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?

+0

좋아요,하지만 휴대 전화가 두 대 이상인 경우 목록보기를 사용하여 표시해야합니까? – jgandroid

+0

@jgandroid 같은 화면에 여러 연락처가 있습니까? 어떻게 그렇게? :/ –

+0

위 이미지와 비슷합니다.이 이메일은 2 개이며, 목록보기에있는 이메일입니까? 문제는 연락처 활동이 있고 사용자가 연락처를 클릭하면 연락처를 활동으로 가져 가고이 활동에서 전화, 전자 메일 등을 표시합니다 ... – jgandroid

관련 문제