2011-10-17 113 views
0

我使用以下xml佈局時,我調用此佈局,佈局不顯示從屏幕頂部它從ListView開始,textview獲取隱藏頂部。我們可以在滾動後看到textview。任何建議?佈局不顯示從頂部在Android

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:background="@drawable/homebg" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="fill_parent" android:id="@+id/mainlinearLayout" 
     android:orientation="vertical"> 
     <ScrollView android:focusable="false" android:layout_width="fill_parent" 
      android:focusableInTouchMode="false" android:layout_height="fill_parent" android:foregroundGravity="top"> 

      <LinearLayout android:layout_width="fill_parent" 
       android:orientation="vertical" android:id="@+id/linearLayout1" 
       android:layout_height="fill_parent"> 

       <LinearLayout android:id="@+id/linearLayout" 
        android:orientation="vertical" android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:focusable="true"> 

       <TextView android:layout_marginLeft="30dip" android:text="Americas" 
        android:textSize="22sp" android:layout_height="wrap_content" 
        android:layout_width="wrap_content" android:textColor="#000000" 
        android:id="@+id/tv_america" android:focusable="true" 
        android:layout_marginTop="20dp"> 
       </TextView> 

       </LinearLayout> 

       <LinearLayout android:id="@+id/linearLayout" 
        android:orientation="vertical" android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:focusable="false"> 
        <ListView android:background="@drawable/metro_selection_white_bg" 
         android:cacheColorHint="#00000000" android:id="@+id/americaslist1" 
         android:layout_marginLeft="30dp" android:layout_marginRight="30dp" 
         android:layout_marginTop="20dp" android:layout_width="fill_parent" 
         android:focusable="false" android:layout_height="1150dp"> 
        </ListView> 

        <TextView android:layout_gravity="top|left" 
         android:layout_marginLeft="30dip" android:text="Europe" 
         android:textSize="22sp" android:layout_height="wrap_content" 
         android:layout_width="wrap_content" android:textColor="#000000" 
         android:layout_marginTop="20dip" android:id="@+id/tv_europe"> 
        </TextView> 

        <ListView android:background="@drawable/metro_selection_white_bg" 
         android:cacheColorHint="#00000000" android:layout_marginBottom="20dip" 
         android:layout_marginLeft="30dip" android:layout_marginRight="30dip" 
         android:id="@+id/europelist2" android:layout_width="fill_parent" 
         android:layout_marginTop="20dip" android:layout_height="490dp"> 
        </ListView> 

        <TextView android:layout_gravity="top|left" 
         android:layout_marginLeft="30dip" android:text="Asia-Pacific" 
         android:textSize="22sp" android:layout_height="wrap_content" 
         android:layout_width="wrap_content" android:textColor="#000000" 
         android:layout_marginTop="20dip" android:id="@+id/tv_europe"> 
        </TextView> 

        <ListView android:background="@drawable/rrbg2" 
         android:cacheColorHint="#00000000" android:layout_marginBottom="20dip" 
         android:layout_marginLeft="30dip" android:layout_marginRight="30dip" 
         android:id="@+id/asiapacific" android:layout_width="fill_parent" 
         android:layout_marginTop="20dip" android:layout_height="240dp"> 
        </ListView> 

       </LinearLayout> 

      </LinearLayout> 
     </ScrollView> 
    </LinearLayout> 
</FrameLayout>![enter image description here][1] 

enter image description here

回答

1

我想你正在尋找的是一個列表視圖頁眉和頁腳...

public void addHeaderView(View v) 
public void addFooterView(View v) 

使用上述API的應該如上圖所示添加您的TextView和在列表視圖下方。

+0

感謝你的回覆。我知道有關頁眉和頁腳視圖,但我必須根據附加屏幕截圖進行設計...... – Himanshu

+0

爲文本視圖添加背景資源,它與背景圖像相同,並將其添加爲標題並且不添加任何頁腳。 。 – bluefalcon