mercredi 27 mai 2015

Android Layout: My images are filling only about 2/3 of my screen

I have a new Activity with related layout which works fine. Except the ImageView(s) don't cover the whole width of my screen.

I'm using Android Studio (the latest stable version) and surprisingly inside the IDE the preview of my layout looks fine. But when I run the app on my device (or emulator) it doesn't cover the whole screen.

Here is my layout design:

 <RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/root"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_weight="1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <LinearLayout xmlns:android="http://ift.tt/nIICcg"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/cat_food"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/cat_food" />
        <ImageView
            android:id="@+id/cat_drink"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/cat_drink" />
        <ImageView
            android:id="@+id/cat_coffee"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/cat_coffee" />
        <ImageView
            android:id="@+id/cat_shopping"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/cat_shopping" />
        <ImageView
            android:id="@+id/cat_offers"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/cat_offers" />
    </LinearLayout>
</ScrollView>
<include
    android:id="@+id/action_bar"
    layout="@layout/layout_actionbar" />

Any idea what I'm doing wrong here?

Thank you for your help.

P.S. I tried wrap_contents, match_parent, fill_parent already and none of those solved the problem.

Aucun commentaire:

Enregistrer un commentaire