2016-09-04 5 views
2

私は2つのビュー(画面)を持つ簡単なAndroidアプリケーションを持っています。 私のアプリはAndroid TVでも動作させようとしています。私は何が間違っているのか分かりませんが、エミュレータで私のアプリケーションを実行すると私のアプリのロゴは表示されません。私のアプリをAndroid TVアプリケーションに変換するには?

私のマニフェストファイルに何が問題になっています:

<?xml version="1" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="xxx.flagmaster"> 
    <uses-feature android:name="android.software.leanback" 
     android:required="false" /> 
    <uses-feature android:name="android.hardware.touchscreen" 
     android:required="false" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    <category android:name="android.intent.category.LEANBACK_LAUNCHER"/> 
    <application 
     android:allowBackup="true" 
     android:icon="@drawable/flagmasterlogo" 
     android:label="@string/app_name" 
     android:banner="@drawable/flagmastertv" 
     android:supportsRtl="true"> 
     android:theme="@style/AppTheme">  
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> 
      </intent-filter> 
     </activity>  
     <activity android:name=".FlagShowActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"> 
      <meta-data 
       android:name="com.google.android.gms.version" 
       android:value="@integer/google_play_services_version" /> 
      <intent-filter>  
       <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 

答えて

1

マニフェスト、あなたのアイコン(位置とサイズ)とアプリのGradleのファイルをチェックしてみます。私は基本的な活動(アンドロイド)でプロジェクトを作成しようとした後、コメントを追加しました:アンドロイドテレビのサポートと更新私のマニフェストについては

compile 'com.android.support:recyclerview-v7:23.4.0' 
compile 'com.android.support:leanback-v17:23.4.0' 

を:ここで

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="package_name.tvapp"> 

    <uses-permission android:name="android.permission.INTERNET" /> 

    <!-- TV app need to declare touchscreen not required --> 
    <uses-feature 
     android:name="android.hardware.touchscreen" 
     android:required="false" /> 

    <!-- 
    true: your app runs on only TV 
    false: your app runs on phone and TV 
    --> 
    <uses-feature 
     android:name="android.software.leanback" 
     android:required="false" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/icon" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme.NoActionBar"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

はテレビエミュレータのサンプルスクリーンショットです。注:私はアイコンイメージを所有していません。テスト用です。ここで

enter image description here

参照のためのプロジェクトツリーです:参照の場合

enter image description here

関連する問題