2015-01-30 8 views
0

활동에서 나는 listview와 textview를 가지고있다.안드로이드리스트 뷰에 다른 양식의 항목을 추가하는 방법

해당보기를 사용하여 게시판을 만들고 싶습니다. 필자의 경우 listview는 게시물 그룹을 의미하고 textview는 페이지 번호를 의미합니다.

그래서 나는 아래의 코드 쓰기 :.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" tools:context=".MainActivity"> 
    <ListView 
     android:id="@+id/referList" 
     android:layout_width="match_parent" 
     android:layout_height="500dp" 
     /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="[1]" // page number 
     android:layout_below="@id/referList"/> 
</RelativeLayout> 

.XML는 각 뷰 별도로 전체 화면 디스플레이를 분할 그러나을 어떻게해야합니까

(나는리스트 뷰의 높이 "500dp"를 설정하기 때문에) 안드로이드에서 이런 식으로보기? (https://www.google.com/webhp?hl=en&gws_rd=cr,ssl&ei=pJzLVMbBC-HRmwWL3oGgBw&fg=1#hl=en&q=listview는 - 스크롤의 끝에 도달하면, 다음 페이지 번호가 나타납니다.)

답변

1

시도 목록

View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer_layout, null, false); 
ListView.addFooterView(footerView); 
+0

덕분에 꼬리말로 페이지 번호보기를 추가. 잘 작동한다. 귀하의 좋은,하지만 거기에 보이지 않는 textview 및 listview 스크롤의 끝에 도달 할 때까지 전체 화면 걸릴 수있는 방법이 있습니까? – soonoo

+0

목록 뷰의 높이를 500dp에서 match_parent로 변경해보십시오. 목록 내용이 화면 높이보다 작 으면 바닥 글이 표시됩니다. 그렇지 않으면 스크롤을 유지할 수 있으며 결국에는 바닥 글에 도착하게됩니다. –

관련 문제