2012-03-21 3 views
0

xml 레이아웃 문제를 문의하고 싶습니다. 나는 TabActivity라는 주요 액티비티를 가지고 있는데, 이는 ListActivity 인 다른 액티비티에 의해 채워진다. 주요 TabActivity와 함께 scrren에서 페이지 아래쪽에 버튼이있는 회색 스트립을 표시하려고합니다. 문제는 listview의 마지막 항목이 스트립에 의해 숨겨져 있다는 것입니다. 그래서 내가 필요로하는 것은 listview는 버튼 스트립의 테두리가 시작되는 같은 지점에 경계선이 있어야한다는 것입니다. 그것은 여기 사진에 의해 증명된다Android XML 레이아웃 오버레이

http://postimage.org/image/h8yx7jxlj/

I

PS는 방법이 방법이 있나요 ... 이미 wrap_content 여러 레이아웃의 layout_height 매개 변수를 변경하려하지만 도움이 hasn't이 탭 머리글의 글꼴 크기를 변경하려면 IN XML LAYOUT FILE?

이 주요 활동의 내 XML 레이아웃입니다 :

<?xml version="1.0" encoding="utf-8"?> 

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:padding="5dp"> 

    <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 


    <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:padding="5dp" /> 


</LinearLayout> 

<LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:gravity="center" 
     android:background="#666666"> 

    <Button android:id="@+id/settins_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="1sp" 
      android:text="volba zdrojů" 
      android:enabled="false" /> 

</LinearLayout> 

탭의 내용으로 TabControl에 삽입되어 활동 이것은 XML 레이아웃 코드. (다음을 TabControl의 FrameLayout이 삽입) :

<?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"> 

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


<TextView 
     android:id="@+id/android:empty" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:gravity="center_vertical|center_horizontal" 
     android:text="@string/main_no_items"/> 

</LinearLayout> 

대단히 감사합니다!

+0

는 그 아래있는 LinearLayout이는 TabHost에 비해 더 공간을 차지하지하는 원인이 그것에 비중이 동안 문제가, 상단의 LinearLayout가 fill_parent로 설정 높이를 가진 때문이라고 생각합니다. 상단 LinearLayout을 wrap_content 높이로 변경해보십시오. –

답변

1

LinearLayout 대신 RelativeLayout을 사용하십시오. 원하는 코드와 정확히 일치하는 코드를 참조하십시오.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#FFFFFF" > 

    <TextView 
     android:id="@+id/text" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@+id/button" 
     android:layout_alignParentTop="true" 
     android:gravity="center_horizontal" 
     android:text="some text goes here" 
     android:textColor="#1E1E1E" 
     android:textSize="25sp" /> 

    <LinearLayout 
     android:id="@+id/button" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:orientation="horizontal" > 

     <Button 
      android:id="@+id/btn_send" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="15dp" 
      android:layout_marginRight="15dp" 
      android:layout_weight="50" 
      android:onClick="handleSendReport" 
      android:text="@string/button_send" /> 
    </LinearLayout> 

</RelativeLayout> 
관련 문제