2012-04-06 120 views
0

所以即時嘗試使用相對佈局(對於屏幕底部的基本應用程序選項卡),並沒有顯示當我將它放在LinearLayout之後2其他佈局(LinearLayout和ScrollView )。 ScrollView包含幾個文本視圖和滾動它自己和linearlayout之前它也很好地工作,但我試圖放置在屏幕底部的相關佈局不起作用。 這裏是什麼,我試圖做的通用代碼:Android應用程序RelativeLayout沒有顯示

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:orientation="vertical" 
    android:background="@drawable/common_bg" 
    android:layout_height="fill_parent"> 

    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="50dp"> 

     <TextView android:layout_height="50dp" 
      android:text="Heading" 
      android:gravity="center" 
      android:textSize="17dp" 
      android:textColor="@color/white" 
      android:textStyle="bold" 
      android:layout_width="fill_parent"> 
     </TextView> 
    </LinearLayout> 

    <ScrollView android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:scrollbars="none" 
     android:layout_gravity="top" 
     android:layout_marginBottom="60dp"> 

      <LinearLayout android:layout_width="fill_parent" 
      android:orientation="vertical" 
      android:paddingTop="15dp" 
      android:layout_weight="1" 
      android:paddingLeft="15dp" 
      android:paddingRight="15dp" 
      android:layout_height="fill_parent"> 

      <TextView android:layout_width="wrap_content" 
         android:textColor="@color/white" 
         android:textSize="18dp" 
         android:textStyle="bold" 
         android:text="@string/text" 
       android:layout_height="wrap_content"> 
      </TextView> 


      </LinearLayout> 

    </ScrollView> 

    <RelativeLayout 
     android:id="@+id/bottomMenu" 
     android:layout_width="wrap_content" 
     android:layout_height="60dp" /> 

</LinearLayout> 

更新:使用即時通訊相對佈局是,我其實不能顯示它在這裏的代碼的方式定製的,但它包含無線電有幾個按鈕的組。

更新2:好的,所以我通過在3個佈局(第一個線性,一個拿着卷軸和底部相關佈局)上操作layout_height =「wrap_content」來解決問題,以及操縱每個佈局的layout_wieght直到我滿意的方式看起來...它似乎不是這是最好的解決方案,但它的工作,所以我不能抱怨太多大聲笑...

回答

0

相對佈局本身不會顯示在xml圖形佈局中,或者當您運行應用程序時,它需要一個子元素來佔據父佈局,嘗試在相對佈局中放置文本視圖,它將顯示,將其置於具有滾動的線性佈局下方查看,它會正常工作,我只是試着用你的代碼,它的工作原理

+0

它仍然無法正常工作。我甚至多餘的包含在一個線性視圖中的scrollview,但我作爲relativeview的bottomMenu仍然不會出現。我有日食向我展示了圖形視圖,但它顯示出底部菜單在屏幕下方,就好像滾動視圖佔用了所有屏幕並推出了其他任何東西。現在,當我嘗試將它放入scrollview時,relativeview bottomMenu會出現,它只出現在滾動linearlayout的底部...任何想法如何我可以解決這個問題? – Intrivix 2012-04-06 20:51:46

相關問題