user3485978 user3485978 - 4 months ago 14
Android Question

Relative layout doesnot take full screen

In my application I want the

RelativeLayout
to cover the whole screen. But when I run my application the height is lesser than screen height.

Screen dimension: 720x1280
RelativeLayout dimensions: 720x1230

Here is the code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:id="@+id/hello"
tools:context="com.selfie.app.MainActivity" >

<FrameLayout
android:id="@+id/frame1"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<SurfaceView
android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="fill_parent" />

<ImageView
android:id="@+id/opaque"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:visibility="invisible" />

<Spinner
android:id="@+id/spinner1"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/timeranim"

/>

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="150dp"
android:layout_marginTop="250dp"
android:text="TextView"
android:textSize="38dp"
android:textColor="#000000"
android:textStyle="bold"
android:visibility="invisible" />


</FrameLayout>

<Button
android:id="@+id/captureImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="@drawable/cameraanim" />

<Button
android:id="@+id/flash"
android:layout_width="50dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginRight="25dp"
android:layout_toLeftOf="@id/captureImage"
android:background="@drawable/flashanim"
/>

<Button
android:id="@+id/flipCamera"
android:layout_width="50dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="25dp"
android:layout_toRightOf="@id/captureImage"
android:background="@drawable/camera" />

</RelativeLayout>

Answer

match_parent and fill_parent does the same thing. Maybe you should notice the RelativeLayout's parent.

Have a try to request Windows.FEATURE_NO_TITLE before setContentView;