我在main.xml中间设置
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
>
其中background是一张png格式的图片,但是显示却是白色,后来我又找了几张图,同样大小,同样格式,有的能显示,有的却是只显示白色。。求解。这是为什么?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
>
其中background是一张png格式的图片,但是显示却是白色,后来我又找了几张图,同样大小,同样格式,有的能显示,有的却是只显示白色。。求解。这是为什么?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background3"
>
<com.lb.dragtest.MyViewPager
android:id="@+id/viewpager"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
/> <RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:id="@+id/viewGroup"
android:gravity="center_horizontal"
android:layout_marginBottom="120dp"
>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
>
<Button
android:id="@+id/packets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:onClick="shoppingcart"
android:background="@drawable/shopping_cart_normal"
/>
</RelativeLayout>
</RelativeLayout>
这个没有默认背景。那个并不是设置不了背景,而是,有的图片能,有的图片不能,而且这些图片是同样分辨率,同样格式。
不能的都是以纯白色为背景表现出来的。不明白为什么。难道Android的背景设置的图片还需要别的什么条件的?