Android中的背景图像被空背景替换
我有一个android应用程序,第一个屏幕是一个带有蓝色背景图像的登录表单 我的问题是,在像LG G2这样的一些设备中,蓝色图像会出现一瞬间,然后被一个空的或空白的背景所取代,就像那里从来没有图像一样 我真的不知道为什么会这样。在Eclipse中,图像显示正常,我已经在多个设备上测试了我的应用程序,看起来还不错 希望有人能帮我。提前谢谢 这是我设置背景的地方Android中的背景图像被空背景替换,android,Android,我有一个android应用程序,第一个屏幕是一个带有蓝色背景图像的登录表单 我的问题是,在像LG G2这样的一些设备中,蓝色图像会出现一瞬间,然后被一个空的或空白的背景所取代,就像那里从来没有图像一样 我真的不知道为什么会这样。在Eclipse中,图像显示正常,我已经在多个设备上测试了我的应用程序,看起来还不错 希望有人能帮我。提前谢谢 这是我设置背景的地方 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/login_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_background"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="@+id/button_login"
android:layout_width="200dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="226dp"
android:layout_marginTop="15dp"
android:background="@drawable/rounded_corner_green"
android:onClick="onClick_login"
android:text="@string/login_button"
android:textColor="#FFFFFF" />
<EditText
android:id="@+id/edit_username"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_above="@+id/edit_password"
android:layout_centerHorizontal="true"
android:layout_marginBottom="13dp"
android:ems="10"
android:hint="@string/username"
android:padding="5dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />
<EditText
android:id="@+id/edit_password"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_above="@+id/button_login"
android:layout_alignLeft="@+id/edit_username"
android:layout_alignRight="@+id/edit_username"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:padding="5dp"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />
</RelativeLayout>
我有一个想法,但不确定工作 1-使用LinearLayout代替RelativeLayout
2-使用dip作为元素高度,而不是dp将图像放置在可绘制的xxhdpi中。Android可以放大/缩小高/低分辨率设备的图像。它可以有效地缩小图像,但在放大图像的同时,会造成内存问题。当您将图像资源保存在高分辨率可绘制文件夹中时,不需要放大它们。希望这有帮助。你如何设置背景显示相关代码我的坏@kaushik检查我的编辑代码是否正常@carlaIt应该是因为它在大多数设备中都能工作!我只在LG G2 phone@kaushik报告了此错误