Android的背景图像设备没有显示? [英] Android background image not shown in device?

查看:164
本文介绍了Android的背景图像设备没有显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加以下code到的main.xml 来将图像设置为我的应用程序的背景图像:

I add the following code to main.xml to set an image as a background image for my app:

android:background="@drawable/bg"

所以的main.xml 是这样的:

<?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:orientation="vertical"
android:gravity="bottom|fill_vertical"
android:background="@drawable/bg0"
>
<EditText
    android:id="@+id/edWord"
    android:layout_width="fill_parent"
    android:layout_height="53px"
    android:textSize="20px"
    android:singleLine="true"
    android:hint="" 
/>
<LinearLayout xmlns:android=
    "http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="vertical"
    android:layout_weight="1"
    >
    <ListView android:id="@+id/lstWord"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
    />

</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
>
    <ImageButton
        android:id="@+id/btnGetText"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:src="@drawable/get"
        android:layout_weight="0.25"
    />
    <ImageButton
        android:id="@+id/btnFind"
        android:text="Click me..."
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:src="@drawable/find"
        android:layout_weight="0.25"
    /> 

</LinearLayout>
</LinearLayout>

当然,图像 bg.png 绘制

的问题是,在背景图像中仅示出在仿真器,但不是在我的实际装置(HTC欲望)。

The problem is that the background image is shown only in the emulator but not in my actual device (HTC Desire).

我做了什么错?什么我需要做的,解决这个问题?

你们可以有帮助吗?非常感谢你。

Can you guys there help? Thank you very much.

推荐答案

我发现这个问题。距离主要的线性布局重力删除 FILL_PARENT 。无需设置背景在ListView,你现在做的。只要改变,因为我认为它解决您的问题。

I found the problem . Just remove fill_parent from the main Linear Layout Gravity. No need to set background in the Listview as you do right now. Just Change as i suggest it solve your problem.

android:gravity="bottom|fill_vertical"

这篇关于Android的背景图像设备没有显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆