所以这里的情况。
我想为android制作一个简单的游戏。这对我自己来说是有教育意义的,所以我想尝试很多可用的功能。
这就是问题所在。
启用硬件加速(通过应用程序或通过在 android 4 中的开发人员选项中强制它,使应用程序的第一个视图绘制错误。它是由帖子底部的 xml 制作的一个非常简单的菜单。
<更新>
它在三星银河系出现问题的地方。第一张图片来自模拟器(终于让它开始了......)它似乎工作。
应该是_______________它是怎样的
第二张图片渐变在屏幕上(没有编程)它不是反射或任何东西。您所看到的正是屏幕显示的内容。
白天的时候会拍出更好的照片...
</更新>
我已经恢复到应用程序的最基本/空代码,这意味着唯一的代码在主 java 类中,设置要显示此视图并且问题仍然存在。
我看到的好像主视图正在调整到我屏幕的 1/4。并且所有视图(按钮可绘制文本视图)都绘制得非常小。
- 我知道如何禁用硬件加速。
- 我知道如何启用和禁用每个视图/活动等等。
- 我知道如何“修复”应用程序。
但我想要的是知道为什么。什么是硬件加速不能在简单的文本视图或线性布局中。这里实际发生了什么?
对不起,我的问题有点彻底。我只是找不到有关此的任何信息。“硬件加速破坏了我的应用程序”的通常答案似乎是“关闭它”。但这几乎不是“修复”
另请注意,我没有使用文档中描述为与硬件加速不兼容的任何内容。
主.java:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
主.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/ilogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="test"
android:background="@drawable/logo"
/>
<Button
android:id="@+id/play"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Play"
android:textSize="24sp"
android:background="@drawable/button"
android:textColor="@drawable/button_color"
/>
<Button
android:id="@+id/highscore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="highscore"
android:textSize="24sp"
android:background="@drawable/button"
android:textColor="@drawable/button_color"
/>
<Button
android:id="@+id/quit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Quit"
android:textSize="24sp"
android:background="@drawable/button"
android:textColor="@drawable/button_color"
/>
</LinearLayout>
清单.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lima.ict"
android:versionCode="1"
android:versionName="1.0">
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:hardwareAccelerated="true"
>
<activity android:name="pong"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>