2010-06-02 7 views
2

이 작업에는 맨 위에 텍스트 뷰가 있고 가운데에 확장 가능한 목록 뷰가 있고 하단에 버튼이 있습니다. 내 문제는 내가 클릭했을 때입니다.
확장형 목록보기 확장형 목록은 버튼과 확장형 목록보기 사이의 공간에 배치됩니다.Android에서 ExpandableListView

확장 가능한 목록보기가 확장 된 전체보기로 표시되고 단추가 확장 가능한 목록보기의 포함에 따라 아래로 이동해야했습니다. 그리고 저는 scrollview를 주요 레이아웃으로 사용했습니다.
감사합니다.

+0

후 당신의 XML 레이아웃. 아마도 height = wrap_layout을 사용해야 할 것입니다. scrollview 내부에서 listview를 푸는 것은 스크롤하는 법을 알고있는 목록이 있기 때문에 권장하지 않습니다. – Pentium10

답변

1

android : layout_weight 속성을 가진 LinearLayout입니까?

0

기본 레이아웃으로 ScrollView를 사용하는 대신 LinearLayout을 Button없이 사용하십시오. 예를 들어 :

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

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="TextView" /> 

     <TextView 
      android:id="@+id/textView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="TextView" /> 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="TextView" /> 

     <ExpandableListView 
      android:id="@+id/expandableListView1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </ExpandableListView> 

    </LinearLayout> 

는 같은 ExpandableListView의 footerView으로 버튼을 추가

final ExpandableListView elv = (ExpandableListView) findViewById(R.id.expandableListView1); 
Button btn = new Button(this); 
elv.addFooterView(btn); 

버튼은 항상이를 사용하여 ExpandableListView의 끝 부분에 존재합니다. 당신이 원하는대로.

0

확장 가능한 Listview와 버튼을 상대적 레이아웃으로 배치하고 아래에 정렬 버튼을 설정해야합니다.이 버튼은 저에게 효과적입니다.

0

사용자 정의 ExpandableListView 튜토리얼

http://www.mysamplecode.com/2012/10/android-expandablelistview-example.html

+0

답변을 게시 해 주셔서 감사합니다! 이 사이트의 대답의 핵심 부분을이 사이트에 게시하거나 게시물의 위험 요소를 삭제해야합니다. [링크보다 간신히 답을 제시하는 FAQ를 참조하십시오.] (http : // stackoverflow. co.kr/faq # deletion) 원하면 '참조'로만 링크를 포함 할 수 있습니다. 대답은 링크가 필요없이 독자적으로 서 있어야합니다. – Taryn

관련 문제