user3110137
user3110137

Reputation: 147

different layout between what appear on emulator and what on xml

i am developing an android application

i design my xml so it is

enter image description here

However, when i run the application on emulator, i got this result

enter image description here

notice please the circle red. why this different between the two?

my english is bad, if u didn't understood me, please say to me

this is the xml

<?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="wrap_content" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

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

            <ImageView
                android:id="@+id/iv_logo"
                android:layout_width="150sp"
                android:layout_height="150sp"
                android:background="@drawable/roma_logo" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/iv_logo"
                android:paddingLeft="10sp"
                android:paddingTop="10sp"
                android:text="@string/action_settings"
                android:textColor="#000000"
                android:textSize="20sp" />

            <Button
                android:id="@+id/b_subscribe"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/iv_logo"
                android:layout_alignParentRight="true"
                android:text="@string/action_settings" />
        </RelativeLayout>

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:src="@drawable/boarder" />

        <HorizontalScrollView
            android:id="@+id/hsv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fillViewport="true"
            android:measureAllChildren="false"
            android:scrollbars="none" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageView
                    android:layout_width="200sp"
                    android:layout_height="289sp"
                    android:paddingRight="@dimen/activity_horizontal_margin"
                    android:src="@drawable/roma1" />

                <ImageView
                    android:layout_width="200sp"
                    android:layout_height="289sp"
                    android:paddingRight="@dimen/activity_horizontal_margin"
                    android:src="@drawable/roma2" />

                <ImageView
                    android:layout_width="200sp"
                    android:layout_height="289sp"
                    android:paddingRight="@dimen/activity_horizontal_margin"
                    android:src="@drawable/roma3" />
            </LinearLayout>
        </HorizontalScrollView>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/border_thin"
                android:paddingBottom="@dimen/activity_vertical_margin"
                android:src="@drawable/boarder_thin" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center|left"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:text="@string/date_of_establishment"
                android:textColor="#da1337"
                android:textSize="20sp"
                android:textStyle="italic" />

            <TextView
                android:id="@+id/tv_date_of_establishment"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:text="1999"
                android:textColor="#000100"
                android:textSize="15sp" />

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/border_thin"
                android:paddingTop="@dimen/activity_vertical_margin"
                android:src="@drawable/boarder_thin" />
        </LinearLayout>
    </LinearLayout>

</ScrollView>

the wrong happended in the imageview witch have drawable called boarder and boarder_thin

Upvotes: 0

Views: 245

Answers (1)

ramaral
ramaral

Reputation: 6179

Perhaps the image is smaller than the display width.

Add android:scaleType="fitXY" to ImageView to scale it

The same effect can be achieved by changing android:src="@drawable/boarder" to android:background="@drawable/boarder"

Background drawables always fit the view.

Upvotes: 1

Related Questions