[英]Android Fragment: empty space on top
I built an app with fragments and I have a ListView with a search widget on top. 我用片段构建了一个应用程序,并且有一个ListView和顶部的搜索小部件。 This Listview layout is the layout for one fragment.
此Listview布局是一个片段的布局。 Whenever I start the app there is an annoying white part on top of the SearchWidget that makes the whole Layout look weird and I can't seem to get rid of it.
每当我启动该应用程序时,SearchWidget顶部都会有一个令人讨厌的白色部分,这使整个布局看起来很奇怪,而且我似乎也无法摆脱它。 It is below the title.
它在标题下方。 But Maybe I am doing something wrong, maybe this has something to do with the action bar?
但是,也许我做错了什么,也许这与操作栏有关? I am new to fragments and have never used action bar.
我是零碎的新手,从未使用过动作栏。 Maybe I am also using it wrong.
也许我也用错了。 Is there a possibility to get rid of it, or should I do something differently?
是否有可能摆脱它,或者我应该做些其他改变吗? http://imgur.com/rzcLztY (image of the Layout - the white space is what i want to get rid of)
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>
Just figured it out myself: 我自己才知道:
android:layout_marginTop="?android:attr/actionBarSize"
consumed the space. 占用了空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.