대화 목록과 메신저 UI가 있습니다. 원하는 목록 : 대화 목록의 항목을 클릭하면 메신저 UI가 해당 대화 메시지와 함께 나타납니다. 시도 : 지금까지이 코드를 코딩하지 않았으므로 아이디어를 찾았습니다. 각 메시지를 즉시 DB에 저장하는 것이 좋으며 대화간에 이동할 때 적절한 메시지를 삭제할 수 있습니까?대화를 탐색하고 이전 메시지를 봅니다.
답변
최근에 비슷한 일을했습니다. 이를 달성하기 위해 TabHost를 사용했습니다. FrameLayout은 TextView로 변환 될 수있는 각각의 FrameLayout과 연관되어 있습니다. TextView는 원하는대로 가정합니다.
이 접근법은 장애가 있습니다. 현재 열린 탭의보기 (이 경우 TextView)에 액세스 할 수 있습니다. 비활성 탭에 텍스트를 추가 할 계획이 없다면 TabHost가 각 탭의 이전 메시지를 처리 할 때 더 이상 수행 할 필요가 없습니다. 예를 들어 비활성 탭에 메시지를 추가하려면 메시지를 대기열에 먼저 저장하고 탭이 활성화 된 후에는 OnTabChangedListener 이벤트로 메시지를 처리해야합니다.
final TabHost th = (TabHost) (this.findViewById(android.R.id.tabhost));
th.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(final String tabId) {
// Here you do the stuff you need. tabId is the name (also called Indicator) of the activated tab
}
});
또한 제어 알고 있어야합니다 : 당신이 tabchange의 이벤트를 처리해야하는 경우, 당신이 뭔가를해야
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/TabContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="99"
android:orientation="vertical">
<TabHost
android:id="@+android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/TabLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- This makes your TabHost horizontally scrollable if it reaches a certain number of tabs -->
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<TabWidget
android:id="@+android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TabWidget>
</HorizontalScrollView>
<!-- You may also want to make this FrameLayour vertically scrollable -->
<FrameLayout
android:id="@+android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"></FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
다음 TabHost 구조에 대한 내 정의의
각 탭의 버퍼 즉, 제어하지 않고 커지면 앱이 무책임하기 시작할 수있는 것처럼 각 탭에 X 개 이상의 메시지가없는 것을 제어합니다. 그들이 나에게했던 것처럼
이 링크는 도움이 될 나는이 부분을 프로그래밍 할 때 :
https://gist.github.com/jerolimov/618086
http://androidituts.com/android-tab-layout-example/
http://learnandroideasily.blogspot.com.es/2013/07/android-tabwidget-example.html
을DB에 conv를 저장하는 것이 좋습니다. 데이터를 직렬화해야합니다. 또는 파일을 사용하여 저장해야합니다.? 또는 구분 기호를 사용하여 임의 액세스 권한을 가질 수 있습니다.
- 1. 버튼이있는 객체 컬렉션을 탐색하고 패널에서 선택된 객체를 봅니다.
- 2. BizTalk 오케스트레이션을 통해 작동하는 메시지를 봅니다.
- 3. 봅니다
- 4. Jquery - 메시지를 추가하고 이전 메시지를 지우는 방법?
- 5. iChat은 대화를 어떻게 시작합니까?
- 6. 벨로 시티 DI 메시지를 전달하려고 시도했습니다. 리디렉션에서 successView를 봅니다.
- 7. python pandas : groupby apply 함수는 이전 행을 봅니다.
- 8. 이미지를 탐색하고 DIV에 asp.net
- 9. jquery-cycle2에서 data-cycle-fx = "none"을 사용하는 경우 이전 이미지가 변경되기 전에 이전 이미지를 봅니다.
- 10. 그룹 SMS 대화를 감지하는 방법
- 11. Android : 대화를 만드는 것
- 12. GMail에서 대화를 계속하는 방법?
- 13. 현재 활동에 대화를 표시합니다.
- 14. 하는 방법은 JFace의 대화를
- 15. 안드로이드 공유 대화를 통해
- 16. Xib에서 대화를 표시 파일
- 17. 방법 지정 대화를
- 18. android에서 대화를 업데이트하는 방법
- 19. 진행률 대화를 보여주는 게시물
- 20. 어떤 종류의 (Page) 내가 탐색하고 있습니까?
- 21. UITableView와보기를 탐색하고 데이터를 유지 하시겠습니까?
- 22. Android에서 설명서를 탐색하고 이해하려면 어떻게해야합니까?
- 23. 디렉토리를 탐색하고 파이썬에서 텍스트를 반환
- 24. webview에서 다른 파일을 탐색하고 싶습니다.
- 25. 이전 페이지에 오류 메시지를 표시하는 방법?
- 26. Smartgit에서 이전 커밋 메시지를 편집하려면 어떻게해야합니까?
- 27. ActiveMQ 대기열에서 이전 메시지를 검색하는 방법
- 28. ShowDialog()가 이전 메시지를 표시하는 이유는 무엇입니까?
- 29. Django는 기본값을 템플릿으로 봅니다.
- 30. Sharepoint는 그룹 순서를 봅니다