これが状況です。
アンドロイド用の簡単なゲームを作りたいです。それは私自身のために教育的であることを意図しているので、私は利用可能な多くの機能を試してみたいと思います。
そして、ここに問題があります。
ハードウェアアクセラレーションを有効にする(アプリケーションを介して、またはandroid 4の開発者オプションで強制することにより、アプリの最初のビューが間違って描画されます。投稿の下部にあるxmlによって作成された非常にシンプルなメニューです。
<更新>
それがうまくいかないのはサムスンギャラクシーネクサスです。最初の画像はエミュレーターからのものです(最終的に起動しました...)そこでは機能しているようです。
_________________________どうあるべきか
2番目の画像は、グラデーションが画面に表示されています(プログラムされていません)。反射などではありません。表示されるのは、画面に表示されているものとまったく同じです。
昼間はもっと良い写真を撮ることができません...
</更新>
アプリの最も基本的な/空のコードに戻りました。つまり、このビューが表示されるように設定するメインのJavaクラスに唯一のコードがあり、問題は解決しません。
私が見ているのは、メインビューが画面の1/4にサイズ変更されているようです。そして、すべてのビュー(ボタンドローアブルテキストビュー)は非常に小さく描かれています。
- ハードウェアアクセラレーションを無効にする方法を知っています。
- 私は、すべての単一のビュー/アクティビティなどに対して有効または無効にする方法を知っています。
- アプリを「修正」する方法を知っています。
私が欲しいのは、その理由を知ることです。単純なテキストビューまたはlinearlayoutでハードウェアアクセラレーションができないのは何ですか。ここで実際に何が起こっているのですか?
私の質問を少し徹底して申し訳ありません。私はこれについての情報を見つけられません。「ハードウェアの高速化によってアプリが破損する」に対する通常の答えは、「オフにする」のようです。しかし、それはほとんど「修正」ではありません
また、ハードウェアアクセラレーションと互換性がないとドキュメントに記載されているものは使用していないことにも注意してください。
main.java:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
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>