Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background image in linear layout is not well sized

I made a linear layout with a background image, a png... I don't know how to show it into the layout ( and centered ) keeping proportions... here is the code

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background">

Obviously image has the same height and width of the display... Any help?? Thanks in advance

=.4.S.=

like image 748
Erenwoid Avatar asked Feb 23 '23 23:02

Erenwoid


1 Answers

Thank you all ^^ I solved in this way:

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">


    <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/background"
        android:layout_gravity="center"/>


    <ListView android:id="@+id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:divider="#FFFFFF"
        android:layout_weight="2"
        android:drawSelectorOnTop="false"
        android:layout_gravity="center"/>

</FrameLayout>
like image 84
Erenwoid Avatar answered Mar 06 '23 23:03

Erenwoid