English 中文(简体)
在Create 上立即开始的另一项活动使用nodpid 提款器时失败
原标题:nodpi drawables fail when used from another activity immediately started in onCreate

我一直在我的应用程序中 使用无光抽取器 对于疲劳的背景, 它工作得很好, 但当它失败了 当我开始 另一项活动 在我的主要活动 的Create 上。

这种行为不会发生在一个模拟器中, 它让我觉得它与设备有关。 我用三星银河笔记来测试它( Android 2.3. 6) 。

Reproduction

为了调试目的,我创建了一个新工程, 在可绘图nodpi 文件夹中添加了 tile. png, 在可绘图文件夹中创建了 bg_ tile. xml, 并将主. xml 版式布局文件中的背景设置为“ @ drawable/ bg_ tile ”

迄今为止情况良好:

https://i.sstatic.net/FGrr1.png" rel=“no follow'>https://i.sstatic.net/FGrr1.png

现在,我已将 < main.xml 复制为 < strong> profession.xml ,并创建了另一种使用second.xml的活动。

为了开启第二手活动,我把它添加到主要活动日期上:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent activityIntent = new Intent(this, NoDPISecondaryActivity.class);
    this.startActivity(activityIntent);
}

次要活动应与主要活动以同样的瓦度背景显示,但以其缩放比例表示:

https://i.static.net/9Xwwp.png

What next?

这仅仅是三星的事情 和我要学会生活的地方有关 或者有人知道是怎么回事 以及如何纠正这种行为吗?

我的意见是:

  • 按下“ 回溯” 返回主活动, 以正确显示拖动背景 。

  • 另外, 当我使用 OnClickListener 的按钮启动第二个活动时, 第二个活动会正确显示正确 。

< 加固> bg_tile.xml 文件的内容 :

<bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/tile"
    android:tileMode="repeat" />
最佳回答

在向Android 4. 0 更新银河注释后,这个问题已经解决。 看起来这是一个供应商/设备特有的错误。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签