2011-11-22 4 views
0
 <?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" 
    style="@style/listbag"> 
    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="1dp"> 
    <ListView 
     android:id="@+id/groupListView" 
     style="@style/listbag" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="100" 
     android:listSelector="@drawable/list_selector1" 
     android:background="@drawable/radius" /> 
</LinearLayout> 
<RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="1dp"> 
    <Button 
     android:id="@+id/addfrendstogroupButton" 
     android:layout_width="fill_parent" 
     android:layout_height="42dp" 
     android:text="Create new group" 
     android:textColor="@color/gray2" 
     android:background="@drawable/button_indicator" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     android:layout_marginBottom="1dp" 
     android:layout_alignParentBottom="true" 

     /> 
     </RelativeLayout> 

      </LinearLayout> 

listview를 설정하고 화면 맨 아래에 버튼 하나를 설정하고 싶습니다. 그러나 listView를 채울 때 버튼이 더 이상 나타나지 않습니다. 나는 이유를 모른다. 누구도 날 여기 도와 줄 수 있니?버튼이 내 레이아웃에 나타나지 않습니다.

+0

"ListView 채우기"란 무엇을 의미합니까? – iTurki

답변

1

목록보기 및 단추는 단일 상대 레이아웃에 있어야합니다. 그리고 버튼에 alignparentbottom의 속성을 지정하십시오. 목록보기가 꽉 차서 스크롤해야하는 경우에도 단추는 항상 목록 위에 있습니다.

희망이 도움이됩니다.

0

이 레이아웃은 다음과 같습니다 확인하십시오 : 그렇지 않으면 Button이 갈 것입니다

<RelativeLayout> 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

<Button 
    .... 
    android:id="@+id/button" 
    android:layout_alignParentBottom="true" 
    .... /> 
<ListView> 
    .... 
    android:above="@id/button" 
    .... 
</ListView> 
</RelativeLayout> 

을 :

<RelativeLayout> 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    <ListView> 
     .... 
    </ListView> 
    <Button 
     .... 
     android:layout_alignParentBottom="true" 
     .... /> 
</RelativeLayout> 
0

내가 이렇게 그것을 더 유연하게 될 것이라고 @iturki에 추가 할 ListView의 상단에 따라서 그것의 끝을 숨길.

+0

나는 그 버튼이리스트를 넘을 수 있기를 원한다고 생각한다. – Urban

+0

내가 말한 SWhat은 다른 답변으로'Button'은'ListView'의 끝을 숨길 것입니다. ** 업데이트 ** – pablisco

관련 문제