2011-09-21 4 views
0

나는 listview를 만들고 그 listview는 헤더를 가지고있다. addHeaderView() 메서드를 사용합니다. 그러나 내가 목록보기에서 아래로 스크롤하면 스크롤바가 사라집니다. 이 방법을 피할 수있는 방법이 있습니까? 예를 들어 스크롤하면 여전히 헤더가 항상 표시됩니다.안드로이드의 목록보기에서 스크롤되지만 헤더가 보이기까지

+0

같은 질문 : http://stackoverflow.com/questions/2620177/android-adding-static-header-to-the-top-of-a-listactivity –

+0

에서 [포스트]에서보세요 (http://blog.maxaller.name/2010/05/attaching-a-sticky-headerfooter-to-an-android-listview/) –

답변

0

위젯이 의도 한대로 작동하고 있습니다. 필요한 부분을 보려면 먼저 TextView와 listview가있는 relativelayout을 만들어야합니다. textview는 스크롤과 관계없이 헤더 역할을하고 정적입니다.

1

이렇게하려면 addHeaderView() 방법으로는 그렇게 할 수 없습니다.

머리글을 맨 위에 배치하려면 레이아웃에 배치해야합니다.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <TextView 
     android:id="@+id/titleBarText" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Title"/> 

    <ListView 
     android:id="@android:id/list" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 

</LinearLayout> 
관련 문제