2011-09-06 2 views
0

TabHost의 일부인 꽤 큰 레이아웃 파일이 있습니다. 내 문제는 마지막 RelativeLayout (@ id/footbar)이 내 뷰의 맨 아래에 붙지 않는다는 것입니다. 내가 사용하는 속성이 중요하니.RelativeView를 아래쪽으로 정렬하는 방법

저의 실현 아이디어를 알려주세요. List30을 사이의 과 자리 표시 자 (hline)와 발바닥으로 설정합니다.

현재 풋 막대는 목록에 고정되어 있으며 맨 위에 올바르게 정렬되지만 내용은 확장됩니다. 내가 또는 "match_parent"의 높이를 가지고 목록을 선택하면 "fill_parent"는가 바닥에 모든 공간이 필요하고 이동보기 :(BTW

에서 footbar : 얻을 수있는 방법이 있나요 ?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:id="@+id/abrtimer"> 

    <TextView android:id="@+id/username_timer" 
       android:layout_height="wrap_content" 
       android:layout_width="wrap_content" 
       android:layout_alignParentTop="true" 
       android:layout_alignParentRight="true" 
    /> 

    <ImageView android:id="@+id/hline" 
       android:layout_width="fill_parent" 
       android:layout_height="2dip" 
       android:background="#544444" 
       android:layout_below="@id/username_timer" /> 

    <RelativeLayout android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_below="@id/hline" 
        android:orientation="vertical"> 
     <ExpandableListView android:id="@+id/timerList" 
          android:layout_height="wrap_content" 
          android:layout_width="match_parent" 
          android:drawSelectorOnTop="true" 
          android:gravity="top"/> 

     <LinearLayout android:orientation="horizontal" 
        android:layout_below="@id/timerList" 
        android:id="@+id/footbar" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_alignParentBottom="true" 
        android:gravity="bottom" 
        android:weightSum="10"> 

      <Spinner android:layout_height="wrap_content" 
       android:id="@+id/projectSpinner" 
       android:layout_width="fill_parent" 
       android:layout_gravity="left" 
       android:layout_weight="8"/> 
      <ImageButton android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@android:drawable/ic_menu_add" 
       android:id="@+id/addButton" 
       android:scaleType="centerCrop" 
       android:layout_gravity="right" 
       android:layout_weight="2"/>  
     </LinearLayout> 
    </RelativeLayout> 

</RelativeLayout> 

답변

2

내가 생을 생각한다 : 스케일하여 ImageButton이 회 전자의 높이 또는 라운드 방식에 맞게

감사의 여기

사전

에하면 목록입니다 s 코드가 필요합니다. 조금 단순화되었습니다. 이 레이아웃을 구현하는 데 실제로 RelativeLayout을 사용할 필요는 없습니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:id="@+id/abrtimer"> 

    <TextView android:id="@+id/username_timer" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_gravity="top|right" /> 

    <ImageView android:id="@+id/hline" 
     android:layout_width="match_parent" 
     android:layout_height="2dip" 
     android:background="#544444" /> 

    <ExpandableListView android:id="@+id/timerList" 
     android:layout_height="0dip" 
     android:layout_width="match_parent" 
     android:layout_weight="1" 
     android:drawSelectorOnTop="true" /> 

    <LinearLayout android:orientation="horizontal" 
     android:layout_below="@id/timerList" 
     android:id="@+id/footbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:gravity="bottom" 
     android:weightSum="10"> 

     <Spinner android:layout_height="wrap_content" 
      android:id="@+id/projectSpinner" 
      android:layout_width="fill_parent" 
      android:layout_gravity="left" 
      android:layout_weight="8"/> 
     <ImageButton android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@android:drawable/ic_menu_add" 
      android:id="@+id/addButton" 
      android:scaleType="centerCrop" 
      android:layout_gravity="right" 
      android:layout_weight="2"/>  
    </LinearLayout> 
</LinearLayout>