2012-09-21 4 views
1

Android 용 채팅 응용 프로그램을 만들고 있습니다. 채팅 화면은 어떻게해야합니까? 누구나 XML 레이아웃에서 모든 뷰를 사용해야한다고 말할 수 있습니까? edittext와 listview입니까? Pls 도움. 우리가 Gtalk에서 보는 것과 같은 대화 화면을 만들어야합니다. 두 사람의 채팅 메시지는 화면의 반대쪽에 정렬되어야합니다 (Gtalk 채팅 상자 정렬 스타일 참조). 이것은 내가 원하는 것입니다. 어떻게이 레이아웃을 구현할 수 있습니까? http://upload.wikimedia.org/wikipedia/en/7/75/Google_talk.gifAndroid chat application-xml layout

+0

@raghav의 수드 I는 서버에서 사용자 정보를 검색 할 수 있지만, 나는 대화에서 사람 모두의 채팅 메시지를 표시하는 방법을 모르겠어요. 하나의 listview, edittext 및 제출 버튼 또는 textviews 및 edittext 및 버튼이 필요합니까? 그게 내 의심이야 –

+0

어댑터에 대한 튜토리얼을 읽어 보시고, 튜토리얼을 구현해보십시오. 그리고 나서, 특정 시점에서 문제가 있다면 다시 돌아와 물어보십시오. – Budius

+0

@ 부 디스 나는 모든 것을 다했다. 아직도 나는 어떤 방법으로 더 혼란 스러울 지 모르겠다. –

답변

2

적합한 것을 얻었습니다. 그래서 나는 여기를 공유하고

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="0dip" 
    android:layout_weight="1" > 
    <TextView 
     android:text="@string/text" 
     android:id="@+id/textOutput" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="5dp" 
     android:paddingRight="5dp" 
     android:paddingTop="5dp" /> 
</ScrollView> 

<LinearLayout 
    android:id="@+id/linearLayout1" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:paddingBottom="5dp" 
    android:baselineAligned="true"> 
    <EditText android:layout_weight="1" android:id="@+id/textInput" 
     android:layout_height="45dp" android:layout_width="0dip"> 
     <requestFocus></requestFocus> 
    </EditText> 
    <Button android:text="Send" 
     android:layout_height="45dp" android:layout_width="125dp" 
     android:id="@+id/btnSend"></Button> 
</LinearLayout>