Devk
Devk

Reputation: 117

layout does not fit the screen

I have created a layout. But at the bottom there is a white space left. I want the content of the relative layout at the extreme bottom of the screen. i.e seekbar and button at the bottom.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/images">

<com.example.acer.myapplication.ZoomView
    android:id="@+id/iop"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:gravity="center"/>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <SeekBar
        android:id="@+id/seekBar7"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <Button
        android:id="@+id/button61"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_below="@id/seekBar7"
        android:layout_centerInParent="true"
        android:background="@drawable/play" />
</RelativeLayout>
</LinearLayout>

I want the white space at the bottom should be replaced with the content of relative layout. I have uploaded the image

Upvotes: 0

Views: 62

Answers (2)

Zaraki596
Zaraki596

Reputation: 61

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

instead of wrap_content You should put match_parent.

That would help it out. I hope you know about wrap_content and match_parent.If you don't look at this https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

Upvotes: 0

Deepak Rana
Deepak Rana

Reputation: 549

use this code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/images">

<com.example.acer.myapplication.ZoomView
    android:id="@+id/iop"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:gravity="center"/>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
    <SeekBar
        android:id="@+id/seekBar7"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <Button
        android:id="@+id/button61"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_below="@id/seekBar7"
        android:layout_centerInParent="true"
        android:background="@drawable/play" />
</RelativeLayout>
</RelativeLayout>

Upvotes: 2

Related Questions