sahil
sahil

Reputation: 265

Issues in setting the image in relative layout

Hello i am having a problem in setting the image in relative layout.The problem is that when i set the image with respect to the bottom there is margin left on top of layout and when i set the image to the top there is margin left at the bottom.I am using a scroll view in the layout.

code:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="top"
    android:background="@drawable/layout5_background" >

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom" >

        <Button
            android:id="@+id/layout5_imgbtn_stopbutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layout5_imgv_clock"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="10dp"
            android:background="@drawable/layout5_stopbutton" />

        <ImageView
            android:id="@+id/layout5_imgv_board"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:src="@drawable/layout5_board" />

        <ImageView
            android:id="@+id/layout5_imgv_wood"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="20dp"
            android:src="@drawable/layout5_wood" />

        <ImageView
            android:id="@+id/layout5_imgv_clock"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layout5_imgv_wood"
            android:layout_centerHorizontal="true"
            android:src="@drawable/layout5_clock" />
    </RelativeLayout>

</ScrollView>

Upvotes: 1

Views: 157

Answers (1)

Vinay
Vinay

Reputation: 2415

Why don't you try setting in scroll layout

android:layout_height="wrap-content"

Upvotes: 1

Related Questions