我有此活性:我的RelativeLayout不會填滿屏幕! (包括截屏)
用戶輸入的值時,按壓按鈕並且將結果在底部顯示的(一些計算完成之後)。正如你所看到的,我在綠色底部有一個佈局,這就是答案以白色文本顯示的地方。但是這部分沒有填充屏幕的整個寬度,它的側邊和底部都有白色的邊緣。所以爲了清楚起見,我希望它能夠填充邊緣和底部。
這裏的佈局:
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="fill_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="***"
tools:showIn="@layout/***">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:hint="Present value"
android:id="@+id/present_value_text_box"
android:layout_marginTop="86dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/eq"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="150dp"
android:background="@color/colorPrimary"
android:layout_below="@+id/fab"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="45dp">
<TextView
android:layout_width="282dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/investment_value_answer_text_box"
android:layout_gravity="center"
android:textSize="60dp"
android:textColor="#FFFF"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout >
</RelativeLayout>
我在做什麼錯?我將佈局的寬度設置爲「fill_parent」我認爲這樣做,但也許我錯了。
任何幫助,將不勝感激。在XML
你在根元素一些「填充」,這就是爲什麼周圍有綠化面積的利潤率。如果你喜歡,請保留「padding_top」,除掉其餘部分。 – 0X0nosugar
在發佈之前檢查你錯誤的位置... –
從主(根)RelativeLayout中移除填充屬性。 – SANAT