2011-05-05 97 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