【问题标题】:Background image not showing when app is run on emulator当应用程序在模拟器上运行时背景图像不显示
【发布时间】:2015-01-02 00:56:30
【问题描述】:

我制作的背景图片在模拟器上运行时没有显示,而是出现了白屏。我已经浏览了其他帖子,但什么都没有,图像是 1080x1920 330ppi .png 图像。


我的 xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:background="@drawable/synthesis_background"
    tools:context=".Login$PlaceholderFragment">
<EditText
    android:layout_width="260dp"
    android:layout_height="45dp"
    android:background="@drawable/txtback"
    android:layout_marginTop="135dp"
    android:layout_marginLeft="40dp"
    android:layout_alignParentTop="true" />
    <EditText
        android:layout_width="260dp"
        android:layout_height="45dp"
        android:background="@drawable/txtback"
        android:layout_marginTop="185dp"
        android:layout_marginLeft="40dp"
        android:layout_alignParentTop="true"
        android:inputType="textPassword"
        android:id="@+id/textView" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/Synthesis"
        android:id="@+id/Brand"
        android:textColor="#ffff"
        android:textSize="70dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

LogCat:

01-02 00:46:53.597    3163-3181/com.example.adrian.musicality D/OpenGLRenderer﹕ Render dirty regions requested: true
01-02 00:46:53.601    3163-3163/com.example.adrian.musicality D/﹕ HostConnection::get() New Host Connection established 0xacf23980, tid 3163
01-02 00:48:08.551    3228-3246/com.example.adrian.musicality D/OpenGLRenderer﹕ Render dirty regions requested: true
01-02 00:48:08.554    3228-3228/com.example.adrian.musicality D/﹕ HostConnection::get() New Host Connection established 0xacf23980, tid 3228

【问题讨论】:

    标签: android xml logcat


    【解决方案1】:

    模拟器根本没有足够的内存来渲染那么大的图像。

    它将显示在实际设备上。

    【讨论】:

      【解决方案2】:

      这可能是因为模拟器设置,尝试更改模拟器设置以适应图像的分辨率和大小,并确保图像在 res->drawable-hdpi 文件夹中

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-02-26
        • 1970-01-01
        • 2017-01-29
        • 1970-01-01
        • 1970-01-01
        • 2014-11-21
        • 2021-02-15
        • 1970-01-01
        相关资源
        最近更新 更多