繁体   English   中英

Android Fragment:顶部为空白

[英]Android Fragment: empty space on top

我用片段构建了一个应用程序,并且有一个ListView和顶部的搜索小部件。 此Listview布局是一个片段的布局。 每当我启动该应用程序时,SearchWidget顶部都会有一个令人讨厌的白色部分,这使整个布局看起来很奇怪,而且我似乎也无法摆脱它。 它在标题下方。 但是,也许我做错了什么,也许这与操作栏有关? 我是零碎的新手,从未使用过动作栏。 也许我也用错了。 是否有可能摆脱它,或者我应该做些其他改变吗? http://imgur.com/rzcLztY (布局图-白色空间是我要摆脱的空间)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false"
android:orientation="horizontal" >

<fragment
    android:id="@+id/listFragment"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_marginTop="?android:attr/actionBarSize"
    android:layout_weight="1.12"
    class="org.blabla.ListFragment"
    tools:layout="@layout/activity_people_list" >
</fragment>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
tools:context=".PeopleListActivity" >

<SearchView
    android:id="@+id/searchView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical" />

<ListView
    android:id="@+id/listView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
     >

</ListView>

</LinearLayout>

我自己才知道:

android:layout_marginTop="?android:attr/actionBarSize"

占用了空间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM