简体   繁体   中英

Android XML image in the full width

I have a problem with my xml file, i would like that background_bar take the full screen width (on the top of the screen) but I can't do that.. Please help me Here is my code

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

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

    <ImageView
        android:id="@+id/main_background_bar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/background_bar"/>

    <ImageView
        android:id="@+id/main_logo_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:src="@drawable/logo_bar" />

    <ImageView
        android:id="@+id/main_title_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="27dp"
        android:layout_toRightOf="@+id/main_logo_bar"
        android:src="@drawable/notifme_title_bar" />

    </RelativeLayout>
</LinearLayout>

尝试将android:scaleType="fitXY"或其变体之一添加到background_bar。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM