2011-05-05 96 views
0

我想這樣一個佈局:Android的佈局設計幫助

 
------------------------------------ 
SCROLLABLE BAR CONTAINING SOME ITEMS (Invisible) 
------------------------------------ 
A VIEWFLIPPER WITH TWO WEBVIEW (Should fill the entire screen except for some space required for the toolbar) 
------------------------------------ 
ANOTHER SCROLLABLE BAR (Invisible) 
------------------------------------ 
A TOOLBAR-LIKE FIXED-HEIGHT BAR. 

所以我寫了這個代碼:

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_gravity="fill" android:layout_height="fill_parent" android:layout_width="fill_parent"> 
    <TableRow android:visibility="invisible" android:layout_height="wrap_content" android:layout_width="wrap_content"> 
     <ScrollView android:id="@+id/scvNotes" android:layout_width="fill_parent" android:layout_height="wrap_content"> 
      <LinearLayout android:id="@+id/lilNotes" android:layout_height="wrap_content" android:layout_width="wrap_content"> 

      </LinearLayout> 
     </ScrollView> 
    </TableRow> 
    <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"> 
     <ViewFlipper android:id="@+id/vflVisual" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="fill"> 
      <WebView android:id="@+id/wvFirst" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="fill"> 
      </WebView> 
      <WebView android:id="@+id/wvSecond" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="fill"> 
      </WebView> 
     </ViewFlipper> 
    </TableRow> 
    <TableRow android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
     <ScrollView android:id="@+id/scvPages" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
      <LinearLayout android:id="@+id/lilPages" android:layout_height="wrap_content" android:layout_width="fill_parent" android:visibility="invisible"> 

      </LinearLayout> 
     </ScrollView> 
    </TableRow> 
    <TableRow android:layout_height="wrap_content" android:layout_width="wrap_content"> 
     <LinearLayout android:id="@+id/lilToolbar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> 
      <ImageView android:id="@+id/btnLibrary" android:src="@drawable/libreria" android:layout_height="44px" android:layout_width="28px"> 

      </ImageView> 
     </LinearLayout> 
    </TableRow> 
</TableLayout> 

但它有兩個的TableRow可見創建佈局和網頁視圖不顯示... 兩個滾動列表必須是不可見的,可見如果用戶通過選擇工具欄上的一個選項.. 我應該使用哪種佈局來解決這個問題,需要他們? 預先感謝您。

+0

您是否嘗試過用的LinearLayout或RelativeLayout的? – Stephan 2011-05-05 10:00:46

+1

你應該去RelativeLayout。 – Sujit 2011-05-05 10:04:28

回答

0

第二個表格行使用所有高度可用導致您使用android:layout_height="fill_parent" 這就是爲什麼只有兩個表格行可見。嘗試改變android:layout_height="wrap_content"

+0

問題是,如果我在第二行使用wrap_content,它不會填滿整個可用空間...... – 2011-05-05 10:49:31