2012-04-06 126 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

相关问题