2016-11-24 23 views
0

我六个月前开发了一个应用程序,现在我尝试更新它。 (Android工作室更新)。我创建了一个新的活动,我尝试在下面放置两个布局(它可以是相对布局或线性布局),但它不起作用。我检查我使用填充父项属性的旧项目,但由于更新,我现在无法使用它。Android如何把两个布局放在下面?

enter image description here

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_launcer_screen" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/app_bar_launcer_screen" 
    android:elevation="1dp"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="150dp"></LinearLayout> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/linearLayout6"></LinearLayout> 
    </RelativeLayout> 
</RelativeLayout> 
+0

你的意思是match_parent? – Rippr

+0

请提供验证码 –

+0

我加了一些代码。 – user2265473

回答

0

试试这个

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<LinearLayout 
    android:layout_weight="1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


</LinearLayout> 

<LinearLayout 
    android:layout_weight="0.5" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


</LinearLayout> 

</LinearLayout> 
+0

抱歉不起作用。 – user2265473

+0

你究竟需要什么? –

+0

这将创建与您在图像3中显示的布局相同的方式。 –

0

原因是您正在使用app:layout_behavior="@string/appbar_scrolling_view_behavior"删除此

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:id="@+id/ll_first" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="150dp"> 

     </LinearLayout> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/ll_first"> 

     </LinearLayout> 
    </RelativeLayout> 
相关问题