[英]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.