Reputation:
i would set background of my activity.
this is my layout (populate with list view)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:background="#FFFFFF" >
<TextView
android:id="@+id/girone"
style="@style/NomeSquadra"
android:layout_width="fill_parent"
android:layout_height="20dip" />
<TextView
android:id="@+id/home"
style="@style/NomeSquadra"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_alignParentLeft="true"
android:layout_below="@+id/girone"
android:layout_marginLeft="2dip"
android:gravity="left|center_vertical" />
<TextView
android:id="@+id/away"
style="@style/NomeSquadra"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_alignParentRight="true"
android:layout_below="@+id/girone"
android:layout_marginLeft="2dip"
android:layout_toRightOf="@+id/vs"
android:gravity="right|center_vertical" />
<TextView
android:id="@+id/vs"
style="@style/NomeSquadra"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_below="@+id/girone"
android:layout_centerHorizontal="true"
android:background="#0000FF"
android:gravity="center|center_vertical" />
</RelativeLayout>
If i write android:background="@drawable/logo"
(to relativeLayout), the image logo.png
is not scale... where I'm wrong?
Upvotes: 0
Views: 84
Reputation: 9700
Add android:layout_height
attribute to RelativeLayout
xml as below...
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
Update:
The XML layout which working perfectly...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/logo" >
<TextView
android:id="@+id/girone"
style="@style/NomeSquadra"
android:layout_width="fill_parent"
android:layout_height="20dip" />
<TextView
android:id="@+id/home"
style="@style/NomeSquadra"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_alignParentLeft="true"
android:layout_below="@+id/girone"
android:layout_marginLeft="2dip"
android:gravity="left|center_vertical" />
<TextView
android:id="@+id/away"
style="@style/NomeSquadra"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_alignParentRight="true"
android:layout_below="@+id/girone"
android:layout_marginLeft="2dip"
android:layout_toRightOf="@+id/vs"
android:gravity="right|center_vertical" />
<TextView
android:id="@+id/vs"
style="@style/NomeSquadra"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_below="@+id/girone"
android:layout_centerHorizontal="true"
android:background="#0000FF"
android:gravity="center|center_vertical" />
</RelativeLayout>
Upvotes: 0
Reputation: 2097
Try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/logo"
>
Upvotes: 1
Reputation: 5145
add height to the parent of this layout
android:layout_height="fill_parent"
Upvotes: 0