2017-03-12 33 views
0

我一直在创建一个列表视图活动,因为我想在这个列表活动中添加一个工具栏,我已经创建了一个工具栏,但它显示了像这样的列表视图的后面,我想这个工具栏列表视图上面如何在ListActivity内创建一个工具栏

enter image description here

我不如何​​解决这种情况下,请如果有任何人能解决这个我会很高兴 这是我的XML文件

+0

为什么你删除XML文件?!无论如何,下面的两个答案都是正确的。 – Booger

+0

我没有删除我的XML文件:D –

回答

1

以下行添加到您的ListView(告诉它布局工具栏下方)

android:layout_below="@id/viewab_title" 
+0

感谢您的回答,真的很有用:) –

1

尝试以下的属性布局XML

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_show_order" 
    android:layout_width="368dp" 
    android:layout_height="624dp" 
    tools:layout_editor_absoluteX="0dp" 
    tools:layout_editor_absoluteY="0dp" 
    tools:context="abtech.waiteriano.com.waitrer.ShowOrderActivity"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="?attr/colorPrimary" 
     android:minHeight="?attr/actionBarSize" /> 
    <ListView 
     android:layout_width="fill_parent" 
     android:id="@+id/showOrderListID" 
     android:layout_height="608dp" 
     tools:layout_editor_absoluteY="8dp" 
     tools:layout_editor_absoluteX="8dp" 
     android:layout_alignParentStart="true" 
     android:layout_below="@id/toolbar"/> 
</RelativeLayout>